You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2024/10/27 04:04:50 UTC
(causeway) branch master updated: CAUSEWAY-2297: replace val -> var (commons)
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new 53f1e4ba81 CAUSEWAY-2297: replace val -> var (commons)
53f1e4ba81 is described below
commit 53f1e4ba8146b8edbda589a32880b8a290340cc9
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Oct 27 05:04:43 2024 +0100
CAUSEWAY-2297: replace val -> var (commons)
---
.../apache/causeway/commons/collections/Can.java | 43 ++++++++-------
.../causeway/commons/collections/Can_Empty.java | 3 +-
.../causeway/commons/collections/Can_Multiple.java | 55 ++++++++++---------
.../commons/collections/Can_Singleton.java | 11 ++--
.../commons/collections/ImmutableEnumSet.java | 6 +--
.../commons/functional/IndexedConsumer.java | 4 +-
.../commons/functional/IndexedFunction.java | 4 +-
.../causeway/commons/functional/Railway.java | 3 +-
.../commons/internal/assertions/_Assert.java | 5 +-
.../causeway/commons/internal/base/_Bytes.java | 5 +-
.../causeway/commons/internal/base/_Strings.java | 13 +++--
.../commons/internal/base/_Strings_CamelCase.java | 5 +-
.../causeway/commons/internal/base/_Temporals.java | 7 ++-
.../causeway/commons/internal/base/_Text.java | 17 +++---
.../causeway/commons/internal/base/_Timing.java | 6 +--
.../binding/InternalBidirectionalBinding.java | 11 ++--
.../internal/binding/_BindableAbstract.java | 11 ++--
.../commons/internal/binding/_Bindables.java | 6 +--
.../commons/internal/codec/_DocumentFactories.java | 9 ++--
.../commons/internal/collections/_Arrays.java | 27 +++++-----
.../commons/internal/collections/_Collections.java | 7 ++-
.../commons/internal/collections/_Inbox.java | 4 +-
.../commons/internal/collections/_Lists.java | 23 ++++----
.../commons/internal/collections/_Maps.java | 17 +++---
.../commons/internal/collections/_Multimaps.java | 7 ++-
.../collections/_PrimitiveCollections.java | 3 +-
.../commons/internal/collections/_Sets.java | 5 +-
.../collections/snapshot/_VersionedList.java | 17 +++---
.../compare/_Comparators_SequenceCompare.java | 10 ++--
.../internal/concurrent/_ConcurrentTask.java | 11 ++--
.../internal/concurrent/_ConcurrentTaskList.java | 15 +++---
.../causeway/commons/internal/debug/_Debug.java | 5 +-
.../causeway/commons/internal/debug/_Probe.java | 11 ++--
.../causeway/commons/internal/debug/_Xray.java | 9 ++--
.../commons/internal/debug/_XrayEvent.java | 5 +-
.../causeway/commons/internal/debug/swt/_Swt.java | 5 +-
.../commons/internal/debug/xray/XrayDataModel.java | 25 +++++----
.../commons/internal/debug/xray/XrayModel.java | 3 +-
.../internal/debug/xray/XrayModelSimple.java | 7 ++-
.../commons/internal/debug/xray/XrayUi.java | 41 +++++++-------
.../internal/debug/xray/_CallStackMerger.java | 23 ++++----
.../commons/internal/debug/xray/_SwingUtil.java | 13 +++--
.../debug/xray/graphics/SequenceDiagram.java | 33 ++++++------
.../internal/debug/xray/graphics/_Graphics.java | 9 ++--
.../commons/internal/delegate/_Delegate.java | 3 +-
.../commons/internal/exceptions/_Exceptions.java | 23 ++++----
.../commons/internal/html/_BootstrapBadge.java | 5 +-
.../causeway/commons/internal/image/_Images.java | 17 +++---
.../commons/internal/ioc/_IocContainer.java | 3 +-
.../commons/internal/ioc/_IocContainer_Spring.java | 17 +++---
.../causeway/commons/internal/os/_OsUtil.java | 13 +++--
.../commons/internal/primitives/_Doubles.java | 3 +-
.../commons/internal/primitives/_Floats.java | 3 +-
.../commons/internal/primitives/_Ints.java | 19 ++++---
.../commons/internal/primitives/_Longs.java | 5 +-
.../commons/internal/reflection/_Annotations.java | 25 +++++----
.../reflection/_Annotations_AttributeMethods.java | 2 +-
...nthesizedMergedAnnotationInvocationHandler.java | 17 +++---
.../commons/internal/reflection/_ClassCache.java | 57 ++++++++++----------
.../internal/reflection/_GenericResolver.java | 35 ++++++------
.../commons/internal/reflection/_Generics.java | 7 ++-
.../internal/reflection/_MethodFacades.java | 9 ++--
.../commons/internal/reflection/_Reflect.java | 11 ++--
.../commons/internal/resources/_Resources.java | 5 +-
.../commons/internal/resources/_Serializables.java | 11 ++--
.../internal/testing/_SerializationTester.java | 3 +-
.../org/apache/causeway/commons/io/DataPeer.java | 7 ++-
.../org/apache/causeway/commons/io/DataSource.java | 5 +-
.../org/apache/causeway/commons/io/DtoMapper.java | 5 +-
.../org/apache/causeway/commons/io/FileUtils.java | 9 ++--
.../org/apache/causeway/commons/io/HashUtils.java | 9 ++--
.../org/apache/causeway/commons/io/JaxbUtils.java | 39 +++++++-------
.../org/apache/causeway/commons/io/JsonUtils.java | 7 ++-
.../org/apache/causeway/commons/io/TextUtils.java | 17 +++---
.../org/apache/causeway/commons/io/ZipUtils.java | 13 +++--
.../causeway/commons/collections/CanTest.java | 9 ++--
.../commons/collections/CanVectorTest.java | 4 +-
.../commons/functional/ThrowingRunnableTest.java | 4 +-
.../handlers/ChainOfResponsibilityTest.java | 20 ++++---
.../causeway/commons/internal/base/BytesTest.java | 4 +-
.../commons/internal/base/TemporalsTest.java | 14 +++--
.../commons/internal/base/debug/XrayUiTest.java | 10 ++--
.../commons/internal/binding/BindableTest.java | 44 ++++++++-------
.../commons/internal/collections/Samples.java | 5 +-
.../commons/internal/collections/_ArraysTest.java | 20 ++++---
.../commons/internal/collections/_ListsTest.java | 18 +++----
.../commons/internal/collections/_MapsTest.java | 10 ++--
.../commons/internal/collections/_SetsTest.java | 62 +++++++++++-----------
.../collections/snapshot/VersionedListTest.java | 14 +++--
.../concurrent/ConcurrentTaskListTest.java | 4 +-
.../internal/debug/xray/CallStackMergerTest.java | 6 +--
.../commons/internal/image/_ImagesTest.java | 14 +++--
.../commons/internal/primitives/IntsTest.java | 18 +++----
.../internal/reflection/AnnotationsTest.java | 7 ++-
.../internal/reflection/ClassCacheTest.java | 13 +++--
.../reflection/GenericReflectionMagicTest.java | 18 +++----
.../commons/internal/reflection/GenericsTest.java | 12 ++---
.../internal/resources/JsonYamlReaderTest.java | 5 +-
.../internal/resources/XmlRoundTripTest.java | 7 ++-
.../apache/causeway/commons/io/JaxbUtilsTest.java | 15 +++---
.../apache/causeway/commons/io/JsonUtilsTest.java | 4 +-
.../apache/causeway/commons/io/YamlUtilsTest.java | 4 +-
.../apache/causeway/commons/io/ZipUtilsTest.java | 5 +-
.../causeway/commons/util/StringDelimiterTest.java | 12 ++---
104 files changed, 608 insertions(+), 737 deletions(-)
diff --git a/commons/src/main/java/org/apache/causeway/commons/collections/Can.java b/commons/src/main/java/org/apache/causeway/commons/collections/Can.java
index 11c5ce2a19..e484aab628 100644
--- a/commons/src/main/java/org/apache/causeway/commons/collections/Can.java
+++ b/commons/src/main/java/org/apache/causeway/commons/collections/Can.java
@@ -48,7 +48,6 @@ import org.apache.causeway.commons.internal.base._NullSafe;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
-import lombok.val;
/**
*
@@ -217,7 +216,7 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return empty();
}
- val nonNullElements = Stream.of(array)
+ var nonNullElements = Stream.of(array)
.filter(_NullSafe::isPresent)
.collect(_CanFactory.toListWithSizeUpperBound(array.length));
@@ -239,13 +238,13 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
*/
public static <T> Can<T> ofCollection(final @Nullable Collection<T> collection) {
- val inputSize = _NullSafe.size(collection);
+ var inputSize = _NullSafe.size(collection);
if(inputSize==0) {
return empty();
}
- val nonNullElements = collection.stream()
+ var nonNullElements = collection.stream()
.filter(_NullSafe::isPresent)
.collect(_CanFactory.toListWithSizeUpperBound(inputSize));
@@ -273,7 +272,7 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return (Can<T>)iterable;
}
- val nonNullElements = new ArrayList<T>();
+ var nonNullElements = new ArrayList<T>();
iterable.forEach(element->{
if(element!=null) {
nonNullElements.add(element);
@@ -303,9 +302,9 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return empty();
}
- val nonNullElements = new ArrayList<T>();
+ var nonNullElements = new ArrayList<T>();
while(enumeration.hasMoreElements()) {
- val element = enumeration.nextElement();
+ var element = enumeration.nextElement();
if(element!=null) {
nonNullElements.add(element);
}
@@ -333,7 +332,7 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return empty();
}
- val nonNullElements = stream
+ var nonNullElements = stream
.filter(_NullSafe::isPresent)
.collect(Collectors.toCollection(()->new ArrayList<>()));
@@ -355,7 +354,7 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
// if(instance.isResolvable()) {
// return Can_Singleton.of(instance.get());
// }
-// val nonNullElements = instance.stream()
+// var nonNullElements = instance.stream()
// .collect(Collectors.toCollection(()->new ArrayList<>()));
//
// return Can_Multiple.of(nonNullElements);
@@ -420,7 +419,7 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return empty();
}
- val nonNullMappedElements =
+ var nonNullMappedElements =
stream()
.map(mapper)
.filter(_NullSafe::isPresent)
@@ -473,8 +472,8 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return can;
}
// at this point: can is not empty and variant is not null
- val newSize = can.size() + 1;
- val union = can.stream().collect(Collectors.toCollection(()->new ArrayList<>(newSize)));
+ var newSize = can.size() + 1;
+ var union = can.stream().collect(Collectors.toCollection(()->new ArrayList<>(newSize)));
union.add(element);
return Can_Multiple.of(union);
}
@@ -696,10 +695,10 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return false;
}
- val otherIterator = other.iterator();
+ var otherIterator = other.iterator();
for(T element: this) {
- val otherElement = otherIterator.next();
+ var otherElement = otherIterator.next();
if(!element.equals(otherElement)) {
return false;
}
@@ -725,12 +724,12 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return false;
}
- val thisIterator = this.iterator();
- val otherIterator = other.iterator();
+ var thisIterator = this.iterator();
+ var otherIterator = other.iterator();
while(otherIterator.hasNext()) {
- val otherElement = otherIterator.next();
- val thisElement = thisIterator.next();
+ var otherElement = otherIterator.next();
+ var thisElement = thisIterator.next();
if(!thisElement.equals(otherElement)) {
return false;
@@ -754,12 +753,12 @@ extends ImmutableCollection<T>, Comparable<Can<T>>, Serializable {
return false;
}
- val thisIterator = this.reverseIterator();
- val otherIterator = other.reverseIterator();
+ var thisIterator = this.reverseIterator();
+ var otherIterator = other.reverseIterator();
while(otherIterator.hasNext()) {
- val otherElement = otherIterator.next();
- val thisElement = thisIterator.next();
+ var otherElement = otherIterator.next();
+ var thisElement = thisIterator.next();
if(!thisElement.equals(otherElement)) {
return false;
diff --git a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Empty.java b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Empty.java
index 81bf146dc7..63b01f5315 100644
--- a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Empty.java
+++ b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Empty.java
@@ -48,7 +48,6 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Value;
-import lombok.val;
@Value @NoArgsConstructor(access = AccessLevel.PRIVATE)
final class Can_Empty<T> implements Can<T> {
@@ -297,7 +296,7 @@ final class Can_Empty<T> implements Can<T> {
@Override
public T[] toArray(@NonNull final Class<T> elementType) {
- val array = _Casts.<T[]>uncheckedCast(Array.newInstance(elementType, 0));
+ var array = _Casts.<T[]>uncheckedCast(Array.newInstance(elementType, 0));
return array;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java
index adccabb2ac..a1042b2170 100644
--- a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java
+++ b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Multiple.java
@@ -54,7 +54,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
-import lombok.val;
@RequiredArgsConstructor(staticName="of")
final class Can_Multiple<T> implements Can<T> {
@@ -110,12 +109,12 @@ final class Can_Multiple<T> implements Can<T> {
public Optional<T> get(final int elementIndex) {
// we do an index out of bounds check ourselves, in order to prevent any stack-traces,
// that pollute the heap
- val size = size();
+ var size = size();
if(size==0) {
return Optional.empty();
}
- val minIndex = 0;
- val maxIndex = size - 1;
+ var minIndex = 0;
+ var maxIndex = size - 1;
if(elementIndex < minIndex || elementIndex > maxIndex) {
return Optional.empty();
}
@@ -124,14 +123,14 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public Can<T> sorted(@NonNull final Comparator<? super T> c) {
- val newElements = _Lists.<T>newArrayList(elements);
+ var newElements = _Lists.<T>newArrayList(elements);
newElements.sort(c);
return Can_Multiple.of(newElements);
}
@Override
public Can<T> distinct() {
- val set = new LinkedHashSet<T>(); // preserve order
+ var set = new LinkedHashSet<T>(); // preserve order
set.addAll(elements);
return Can.ofCollection(set);
}
@@ -139,7 +138,7 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public Can<T> distinct(@NonNull final BiPredicate<T, T> equality) {
final int initialSize = Math.min(1024, elements.size());
- val uniqueElements = _Lists.<T>newArrayList(initialSize);
+ var uniqueElements = _Lists.<T>newArrayList(initialSize);
elements
.forEach(element->{
if(!uniqueElements.stream().anyMatch(x->equality.test(x, element))) {
@@ -176,7 +175,7 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public Can<T> reverse() {
- val reverse = new ArrayList<T>(elements.size());
+ var reverse = new ArrayList<T>(elements.size());
for(int i=elements.size()-1; i>=0; --i) {
reverse.add(elements.get(i));
}
@@ -200,7 +199,7 @@ final class Can_Multiple<T> implements Can<T> {
if(predicate==null) {
return this; // identity
}
- val filteredElements =
+ var filteredElements =
stream()
.filter(predicate)
.collect(Collectors.toCollection(ArrayList::new));
@@ -215,7 +214,7 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public <R> void zip(@NonNull final Iterable<R> zippedIn, @NonNull final BiConsumer<? super T, ? super R> action) {
- val zippedInIterator = zippedIn.iterator();
+ var zippedInIterator = zippedIn.iterator();
stream().forEach(t->{
action.accept(t, zippedInIterator.next());
});
@@ -223,13 +222,13 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public <R, Z> Can<R> zipMap(@NonNull final Iterable<Z> zippedIn, @NonNull final BiFunction<? super T, ? super Z, R> mapper) {
- val zippedInIterator = zippedIn.iterator();
+ var zippedInIterator = zippedIn.iterator();
return map(t->mapper.apply(t, zippedInIterator.next()));
}
@Override
public <R, Z> Stream<R> zipStream(@NonNull final Iterable<Z> zippedIn, final BiFunction<? super T, ? super Z, R> mapper) {
- val zippedInIterator = zippedIn.iterator();
+ var zippedInIterator = zippedIn.iterator();
return stream()
.map(t->mapper.apply(t, zippedInIterator.next()))
.filter(_NullSafe::isPresent);
@@ -248,7 +247,7 @@ final class Can_Multiple<T> implements Can<T> {
|| other.isEmpty()) {
return this;
}
- val newElements = new ArrayList<T>(this.size() + other.size());
+ var newElements = new ArrayList<T>(this.size() + other.size());
newElements.addAll(elements);
other.forEach(newElements::add);
return Can_Multiple.of(newElements);
@@ -259,7 +258,7 @@ final class Can_Multiple<T> implements Can<T> {
if(element==null) {
return this; // identity
}
- val newElements = new ArrayList<T>(elements);
+ var newElements = new ArrayList<T>(elements);
newElements.add(index, element);
return Can.ofCollection(newElements);
}
@@ -269,14 +268,14 @@ final class Can_Multiple<T> implements Can<T> {
if(element==null) {
return remove(index);
}
- val newElements = new ArrayList<T>(elements);
+ var newElements = new ArrayList<T>(elements);
newElements.set(index, element);
return Can.ofCollection(newElements);
}
@Override
public Can<T> remove(final int index) {
- val newElements = new ArrayList<T>(elements);
+ var newElements = new ArrayList<T>(elements);
newElements.remove(index);
return Can.ofCollection(newElements);
}
@@ -286,7 +285,7 @@ final class Can_Multiple<T> implements Can<T> {
if(element==null) {
return this; // identity
}
- val newElements = new ArrayList<T>(elements);
+ var newElements = new ArrayList<T>(elements);
newElements.remove(element);
return Can.ofCollection(newElements);
}
@@ -297,7 +296,7 @@ final class Can_Multiple<T> implements Can<T> {
||indices.length==0) {
return Can.empty();
}
- val newElements = new ArrayList<T>(indices.length);
+ var newElements = new ArrayList<T>(indices.length);
final int maxIndex = size()-1;
for(int index:indices) {
if(index>=0
@@ -313,7 +312,7 @@ final class Can_Multiple<T> implements Can<T> {
if(intStream==null) {
return Can.empty();
}
- val newElements = new ArrayList<T>();
+ var newElements = new ArrayList<T>();
final int maxIndex = size()-1;
intStream
.filter(index->index>=0 && index<=maxIndex)
@@ -346,7 +345,7 @@ final class Can_Multiple<T> implements Can<T> {
}
final int n = size();
final int subCanCount = (n - 1)/maxInnerSize + 1;
- val newElements = new ArrayList<Can<T>>(subCanCount);
+ var newElements = new ArrayList<Can<T>>(subCanCount);
for(int i=0; i<n; i+=maxInnerSize) {
newElements.add(subCan(i, i + maxInnerSize)); // index overflow is ignored
}
@@ -370,7 +369,7 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public String toString() {
- val literal = stream()
+ var literal = stream()
.map(s->""+s)
.collect(Collectors.joining(", "));
return "Can["+literal+"]";
@@ -409,24 +408,24 @@ final class Can_Multiple<T> implements Can<T> {
// at this point firstElementComparison is 0 and other is a multi-can
// XXX we already compared the first elements, could skip ahead for performance reasons
if(this.size()>=other.size()) {
- val otherIterator = other.iterator();
+ var otherIterator = other.iterator();
for(T left: this) {
if(!otherIterator.hasNext()) {
return 1; // the other has fewer elements hence comes first
}
- val right = otherIterator.next();
+ var right = otherIterator.next();
int c = _Objects.compareNonNull(left, right);
if(c!=0) {
return c;
}
}
} else {
- val thisIterator = this.iterator();
+ var thisIterator = this.iterator();
for(T right: other) {
if(!thisIterator.hasNext()) {
return -1; // this has fewer elements hence comes first
}
- val left = thisIterator.next();
+ var left = thisIterator.next();
int c = _Objects.compareNonNull(left, right);
if(c!=0) {
return c;
@@ -448,14 +447,14 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public Set<T> toSet() {
- val set = _Sets.<T>newHashSet(); // serializable
+ var set = _Sets.<T>newHashSet(); // serializable
set.addAll(elements);
return Collections.unmodifiableSet(set); // serializable and immutable
}
@Override
public Set<T> toSet(@NonNull final Consumer<T> onDuplicated) {
- val set = _Sets.<T>newHashSet(); // serializable
+ var set = _Sets.<T>newHashSet(); // serializable
elements
.forEach(s->{
if(!set.add(s)) {
@@ -467,7 +466,7 @@ final class Can_Multiple<T> implements Can<T> {
@Override
public T[] toArray(@NonNull final Class<T> elementType) {
- val array = _Casts.<T[]>uncheckedCast(Array.newInstance(elementType, size()));
+ var array = _Casts.<T[]>uncheckedCast(Array.newInstance(elementType, size()));
return elements.toArray(array);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Singleton.java b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Singleton.java
index 554f2aab98..f4307488c6 100644
--- a/commons/src/main/java/org/apache/causeway/commons/collections/Can_Singleton.java
+++ b/commons/src/main/java/org/apache/causeway/commons/collections/Can_Singleton.java
@@ -49,7 +49,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
-import lombok.val;
@RequiredArgsConstructor(staticName="of")
final class Can_Singleton<T> implements Can<T> {
@@ -198,7 +197,7 @@ final class Can_Singleton<T> implements Can<T> {
if(other.isCardinalityOne()) {
return add(other.getSingleton().orElseThrow(_Exceptions::unexpectedCodeReach));
}
- val newElements = new ArrayList<T>(other.size()+1);
+ var newElements = new ArrayList<T>(other.size()+1);
newElements.add(element);
other.forEach(newElements::add);
return _CanFactory.ofNonNullElements(newElements);
@@ -265,7 +264,7 @@ final class Can_Singleton<T> implements Can<T> {
if(pickCount==1) {
return this;
}
- val newElements = new ArrayList<T>(pickCount);
+ var newElements = new ArrayList<T>(pickCount);
for(int i=0; i<pickCount; i++) {
newElements.add(element);
}
@@ -288,7 +287,7 @@ final class Can_Singleton<T> implements Can<T> {
throw _Exceptions.illegalArgument("pickCount %d is too large to fit into an int", pickCountL);
}
final int pickCount = (int) pickCountL;
- val newElements = new ArrayList<T>(pickCount);
+ var newElements = new ArrayList<T>(pickCount);
for(int i=0; i<pickCount; i++) {
newElements.add(element);
}
@@ -381,7 +380,7 @@ final class Can_Singleton<T> implements Can<T> {
@Override
public List<T> toArrayList() {
- val list = _Lists.<T>newArrayList();
+ var list = _Lists.<T>newArrayList();
list.add(element);
return list;
}
@@ -398,7 +397,7 @@ final class Can_Singleton<T> implements Can<T> {
@Override
public T[] toArray(@NonNull final Class<T> elementType) {
- val array = _Casts.<T[]>uncheckedCast(Array.newInstance(elementType, 1));
+ var array = _Casts.<T[]>uncheckedCast(Array.newInstance(elementType, 1));
array[0] = element;
return array;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/collections/ImmutableEnumSet.java b/commons/src/main/java/org/apache/causeway/commons/collections/ImmutableEnumSet.java
index 38c256521d..b85405f07c 100644
--- a/commons/src/main/java/org/apache/causeway/commons/collections/ImmutableEnumSet.java
+++ b/commons/src/main/java/org/apache/causeway/commons/collections/ImmutableEnumSet.java
@@ -22,8 +22,6 @@ import java.util.EnumSet;
import java.util.Iterator;
import java.util.stream.Stream;
-import lombok.val;
-
/**
* Immutable variant of {@link EnumSet}
*
@@ -101,7 +99,7 @@ implements Iterable<E>, java.io.Serializable {
if(contains(entry)) {
return this;
}
- val newEnumSet = delegate.clone();
+ var newEnumSet = delegate.clone();
newEnumSet.add(entry);
return from(newEnumSet);
}
@@ -110,7 +108,7 @@ implements Iterable<E>, java.io.Serializable {
if(!contains(entry)) {
return this;
}
- val newEnumSet = delegate.clone();
+ var newEnumSet = delegate.clone();
newEnumSet.remove(entry);
return from(newEnumSet);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/functional/IndexedConsumer.java b/commons/src/main/java/org/apache/causeway/commons/functional/IndexedConsumer.java
index 9226526a9c..9995c3a695 100644
--- a/commons/src/main/java/org/apache/causeway/commons/functional/IndexedConsumer.java
+++ b/commons/src/main/java/org/apache/causeway/commons/functional/IndexedConsumer.java
@@ -23,8 +23,6 @@ import java.util.function.Consumer;
import org.apache.causeway.commons.internal.base._Refs;
-import lombok.val;
-
/**
* Similar to a {@link BiConsumer}, except that the first argument is an {@code int}.
*
@@ -45,7 +43,7 @@ public interface IndexedConsumer<T> {
* and incremented after each call.
*/
static <T> Consumer<T> offset(final int offset, final IndexedConsumer<T> indexed){
- val indexRef = _Refs.intRef(offset);
+ var indexRef = _Refs.intRef(offset);
return t->indexed.accept(indexRef.getAndInc(), t);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/functional/IndexedFunction.java b/commons/src/main/java/org/apache/causeway/commons/functional/IndexedFunction.java
index da8fcb12f4..2cd7da9561 100644
--- a/commons/src/main/java/org/apache/causeway/commons/functional/IndexedFunction.java
+++ b/commons/src/main/java/org/apache/causeway/commons/functional/IndexedFunction.java
@@ -23,8 +23,6 @@ import java.util.function.Function;
import org.apache.causeway.commons.internal.base._Refs;
-import lombok.val;
-
/**
* Similar to a {@link BiFunction}, except that the first argument is an {@code int}.
*
@@ -45,7 +43,7 @@ public interface IndexedFunction<T, R> {
* and incremented after each call.
*/
static <T, R> Function<T, R> offset(final int offset, final IndexedFunction<T, R> indexed){
- val indexRef = _Refs.intRef(offset);
+ var indexRef = _Refs.intRef(offset);
return t->indexed.apply(indexRef.getAndInc(), t);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/functional/Railway.java b/commons/src/main/java/org/apache/causeway/commons/functional/Railway.java
index 735f7475cf..a7d14568d8 100644
--- a/commons/src/main/java/org/apache/causeway/commons/functional/Railway.java
+++ b/commons/src/main/java/org/apache/causeway/commons/functional/Railway.java
@@ -27,7 +27,6 @@ import org.springframework.lang.Nullable;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
-import lombok.val;
/**
* The {@link Railway} type represents a value of one of two possible types (a disjoint union)
@@ -68,7 +67,7 @@ public interface Railway<F, S> {
default S getSuccessElseFail() { return getSuccess().orElseThrow(); }
@SneakyThrows
default S getSuccessElseFail(final Function<F, ? extends Throwable> toThrowable) {
- val successIfAny = getSuccess();
+ var successIfAny = getSuccess();
if(successIfAny.isPresent()) {
return successIfAny.get();
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/assertions/_Assert.java b/commons/src/main/java/org/apache/causeway/commons/internal/assertions/_Assert.java
index 795fd7cd96..b971713353 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/assertions/_Assert.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/assertions/_Assert.java
@@ -31,7 +31,6 @@ import org.apache.causeway.commons.internal.primitives._Ints;
import org.apache.causeway.commons.internal.primitives._Longs;
import lombok.NonNull;
-import lombok.val;
import lombok.experimental.UtilityClass;
import lombok.extern.log4j.Log4j2;
@@ -267,7 +266,7 @@ public final class _Assert {
assertEquals(a, b, lazyMessage);
return;
}
- val maxScale = Math.max(a.scale(), b.scale());
+ var maxScale = Math.max(a.scale(), b.scale());
assertEquals(
a.setScale(maxScale),
b.setScale(maxScale),
@@ -323,7 +322,7 @@ public final class _Assert {
// -- HELPER
private static void fail(final String message, final Object expected, final Object actual) {
- val error = _Exceptions.assertionError(
+ var error = _Exceptions.assertionError(
buildPrefix(message)
+ String.format("expected: <%s> but was: <%s>", ""+expected, ""+actual));
log.error(error); // in case exceptions get swallowed, make sure errors at least get logged
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Bytes.java b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Bytes.java
index cba2480b47..a513325e46 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Bytes.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Bytes.java
@@ -31,7 +31,6 @@ import java.util.zip.Inflater;
import org.springframework.lang.Nullable;
import lombok.NonNull;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -130,10 +129,10 @@ public final class _Bytes {
if(intStream==null) {
return new byte[0];
}
- val listOfInts = intStream
+ var listOfInts = intStream
.boxed()
.collect(Collectors.toList());
- val bytes = new byte[listOfInts.size()];
+ var bytes = new byte[listOfInts.size()];
IntStream.range(0, listOfInts.size())
.forEach(index->bytes[index]=(byte)(int)listOfInts.get(index));
return bytes;
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java
index e9c5f754ea..26b9984825 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java
@@ -59,7 +59,6 @@ import static org.apache.causeway.commons.internal.functions._Predicates.not;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -345,8 +344,8 @@ public final class _Strings {
return true;
}
try {
- val testDummyUri = new URI("http://localhost/?" + input);
- val asQuery = testDummyUri.getQuery();
+ var testDummyUri = new URI("http://localhost/?" + input);
+ var asQuery = testDummyUri.getQuery();
return input.equals(asQuery);
} catch (Exception e) {
// ignore
@@ -745,7 +744,7 @@ public final class _Strings {
public static String print(
final @NonNull Consumer<PrintStream> printer,
final @NonNull Charset charset) {
- val baos = new ByteArrayOutputStream();
+ var baos = new ByteArrayOutputStream();
try (PrintStream ps = new PrintStream(baos, true, charset)) {
printer.accept(ps);
}
@@ -939,15 +938,15 @@ public final class _Strings {
*
*/
public static String baseName(final @NonNull String methodName) {
- val asPrefixDropped = isNotEmpty(methodName)
+ var asPrefixDropped = isNotEmpty(methodName)
? ofCodePoints(
methodName.codePoints()
.dropWhile(c->c != '_' && Character.isLowerCase(c)))
: "";
- val baseName = asPrefixDropped.isEmpty()
+ var baseName = asPrefixDropped.isEmpty()
? methodName
: asPrefixDropped;
- val javaBaseName = _Strings.capitalize(baseName.trim());
+ var javaBaseName = _Strings.capitalize(baseName.trim());
_Assert.assertNotEmpty(javaBaseName,
()->String.format("framework bug: could not create a base name from '%s'", methodName));
return javaBaseName;
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings_CamelCase.java b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings_CamelCase.java
index 2c5e661234..bc16961b3a 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings_CamelCase.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings_CamelCase.java
@@ -23,7 +23,6 @@ import java.util.function.UnaryOperator;
import org.springframework.lang.Nullable;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -43,8 +42,8 @@ class _Strings_CamelCase {
if(input==null) return null;
if(input.length()==0) return input;
- val sb = new StringBuffer(input.length());
- val tokenizer = new StringTokenizer(input, " \t\n\r\f._,:;");
+ var sb = new StringBuffer(input.length());
+ var tokenizer = new StringTokenizer(input, " \t\n\r\f._,:;");
int tokenCount = 0;
while (tokenizer.hasMoreTokens()) {
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Temporals.java b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Temporals.java
index f913b8c103..ba88562ab5 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Temporals.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Temporals.java
@@ -42,7 +42,6 @@ import org.springframework.lang.Nullable;
import org.apache.causeway.commons.collections.Can;
import lombok.NonNull;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -266,7 +265,7 @@ public final class _Temporals {
public Can<ZonedDateTime> sampleZonedDateTime() {
// don't depend on current TimeZone.getDefault(),
// instead use an arbitrary mix of fixed time-zone offsets Z, +02:00 and -02:00
- val localNow = LocalDateTime.now();
+ var localNow = LocalDateTime.now();
return Can.of(
ZonedDateTime.of(localNow, ZoneId.of("Europe/Paris")),
ZonedDateTime.of(localNow, ZoneOffset.UTC),
@@ -278,7 +277,7 @@ public final class _Temporals {
public Can<OffsetTime> sampleOffsetTime() {
// don't depend on current TimeZone.getDefault(),
// instead use an arbitrary mix of fixed time-zone offsets Z, +02:00 and -02:00
- val localNow = LocalTime.now();
+ var localNow = LocalTime.now();
return Can.of(
OffsetTime.of(localNow, ZoneOffset.UTC),
OffsetTime.of(localNow, ZoneOffset.ofHours(2)),
@@ -288,7 +287,7 @@ public final class _Temporals {
public Can<OffsetDateTime> sampleOffsetDateTime() {
// don't depend on current TimeZone.getDefault(),
// instead use an arbitrary mix of fixed time-zone offsets Z, +02:00 and -02:00
- val localNow = LocalDateTime.now();
+ var localNow = LocalDateTime.now();
return Can.of(
OffsetDateTime.of(localNow, ZoneOffset.UTC),
OffsetDateTime.of(localNow, ZoneOffset.ofHours(2)),
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Text.java b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Text.java
index 5c95a26d6e..b8c2fa69e2 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Text.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Text.java
@@ -34,7 +34,6 @@ import org.apache.causeway.commons.io.TextUtils;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -219,10 +218,10 @@ public final class _Text {
public static void assertTextEquals(final @NonNull Can<String> a, final @NonNull Can<String> b) {
- val na = normalize(a);
- val nb = normalize(b);
+ var na = normalize(a);
+ var nb = normalize(b);
- val lineNrRef = _Refs.intRef(0);
+ var lineNrRef = _Refs.intRef(0);
if(na.size()<=nb.size()) {
na.zip(nb, (left, right)->{
@@ -282,14 +281,14 @@ public final class _Text {
if(line.length()<=maxChars) {
return Stream.of(line);
}
- val tokens = Can.ofEnumeration(new StringTokenizer(line, " .-:/_", true))
+ var tokens = Can.ofEnumeration(new StringTokenizer(line, " .-:/_", true))
.map(String.class::cast);
- val constraintLines = _Lists.<String>newArrayList();
- val partialSum = _Refs.intRef(0);
- val partialCount = _Refs.intRef(0);
+ var constraintLines = _Lists.<String>newArrayList();
+ var partialSum = _Refs.intRef(0);
+ var partialCount = _Refs.intRef(0);
- val tokenIterator = tokens.iterator();
+ var tokenIterator = tokens.iterator();
tokens.stream()
.mapToInt(String::length)
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Timing.java b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Timing.java
index d40f6abafa..3bfd3640e9 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Timing.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Timing.java
@@ -99,7 +99,7 @@ public final class _Timing {
/**
* @return elapsed nano seconds since started
- * (or when stopped, the time interval between started and stopped)
+ * (or when stopped, the time intervar between started and stopped)
*/
public long getNanos() {
return stopped ? t1 - t0 : System.nanoTime() - t0 ;
@@ -107,7 +107,7 @@ public final class _Timing {
/**
* @return elapsed micro seconds since started
- * (or when stopped, the time interval between started and stopped)
+ * (or when stopped, the time intervar between started and stopped)
*/
public long getMicros() {
return getNanos()/1000L;
@@ -115,7 +115,7 @@ public final class _Timing {
/**
* @return elapsed milli seconds since started
- * (or when stopped, the time interval between started and stopped)
+ * (or when stopped, the time intervar between started and stopped)
*/
public long getMillis() {
return getNanos()/1000_000L;
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/binding/InternalBidirectionalBinding.java b/commons/src/main/java/org/apache/causeway/commons/internal/binding/InternalBidirectionalBinding.java
index 8ce4d1e34c..bcd5b3a20a 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/binding/InternalBidirectionalBinding.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/binding/InternalBidirectionalBinding.java
@@ -27,7 +27,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.Getter;
import lombok.NonNull;
-import lombok.val;
//@Log4j2
abstract class InternalBidirectionalBinding<T>
@@ -35,7 +34,7 @@ implements ChangeListener<T>, InternalUtil.WeakListener {
public static <T> InternalBidirectionalBinding<T> bind(final Bindable<T> left, final Bindable<T> right) {
checkParameters(left, right);
- val binding = new GenericBidirectionalBinding<T>(left, right);
+ var binding = new GenericBidirectionalBinding<T>(left, right);
left.setValue(right.getValue());
left.addListener(binding);
right.addListener(binding);
@@ -44,14 +43,14 @@ implements ChangeListener<T>, InternalUtil.WeakListener {
public static <T> void unbind(final Bindable<T> left, final Bindable<T> right) {
checkParameters(left, right);
- val binding = new UntypedBidirectionalBinding(left, right);
+ var binding = new UntypedBidirectionalBinding(left, right);
left.removeListener(binding);
right.removeListener(binding);
}
public static void unbind(final Object left, final Object right) {
checkParameters(left, right);
- val binding = new UntypedBidirectionalBinding(left, right);
+ var binding = new UntypedBidirectionalBinding(left, right);
if (left instanceof Observable) {
((Observable<?>) left).removeListener(binding);
}
@@ -146,8 +145,8 @@ implements ChangeListener<T>, InternalUtil.WeakListener {
if (updating) {
return;
}
- val left = getLeft();
- val right = getRight();
+ var left = getLeft();
+ var right = getRight();
if ((left == null) || (right == null)) {
if (left != null) {
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/binding/_BindableAbstract.java b/commons/src/main/java/org/apache/causeway/commons/internal/binding/_BindableAbstract.java
index ef18c641c2..22b4eb0e4f 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/binding/_BindableAbstract.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/binding/_BindableAbstract.java
@@ -31,7 +31,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.Setter;
-import lombok.val;
/**
@@ -106,7 +105,7 @@ public abstract class _BindableAbstract<T> implements Bindable<T> {
@Override
public T getValue() {
valid = true;
- val val = observable == null
+ var val = observable == null
? value
: observable.getValue();
return valueRefiner.apply(val);
@@ -117,7 +116,7 @@ public abstract class _BindableAbstract<T> implements Bindable<T> {
if (isBound()) {
throw _Exceptions.unrecoverable("Cannot set value on a bound bindable.");
}
- val newValue = valueGuard.apply(proposedNewValue);
+ var newValue = valueGuard.apply(proposedNewValue);
if (value != newValue) {
value = newValue;
markInvalid();
@@ -175,10 +174,10 @@ public abstract class _BindableAbstract<T> implements Bindable<T> {
final Function<T, R> forwardMapper,
final Function<R, T> reverseMapper) {
- val isForwardUpdating = new AtomicBoolean();
- val isReverseUpdating = new AtomicBoolean();
+ var isForwardUpdating = new AtomicBoolean();
+ var isReverseUpdating = new AtomicBoolean();
- val newBindable = _Bindables.<R>forValue(forwardMapper.apply(getValue()));
+ var newBindable = _Bindables.<R>forValue(forwardMapper.apply(getValue()));
addListener((e,o,n)->{
if(isReverseUpdating.get()) {
return;
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/binding/_Bindables.java b/commons/src/main/java/org/apache/causeway/commons/internal/binding/_Bindables.java
index b6251e7753..2c38c5e18a 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/binding/_Bindables.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/binding/_Bindables.java
@@ -18,8 +18,6 @@
*/
package org.apache.causeway.commons.internal.binding;
-import lombok.val;
-
/**
* <h1>- internal use only -</h1>
*
@@ -46,13 +44,13 @@ public class _Bindables {
}
public static <T> _BindableAbstract<T> forValue(final T initialValue) {
- val bindable = new SimpleBindable<T>();
+ var bindable = new SimpleBindable<T>();
bindable.setValue(initialValue);
return bindable;
}
public static BooleanBindable forBoolean(final boolean initialValue) {
- val bindable = new BooleanBindable();
+ var bindable = new BooleanBindable();
bindable.setValue(initialValue);
return bindable;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/codec/_DocumentFactories.java b/commons/src/main/java/org/apache/causeway/commons/internal/codec/_DocumentFactories.java
index d4d5f58601..031a4baecf 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/codec/_DocumentFactories.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/codec/_DocumentFactories.java
@@ -36,7 +36,6 @@ import org.xml.sax.InputSource;
import org.springframework.lang.Nullable;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -54,7 +53,7 @@ import lombok.experimental.UtilityClass;
public class _DocumentFactories {
public DocumentBuilderFactory documentBuilderFactory() {
- val df = DocumentBuilderFactory.newInstance();
+ var df = DocumentBuilderFactory.newInstance();
df.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); // XML parsers should not be vulnerable to XXE attacks
df.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); // XML parsers should not be vulnerable to XXE attacks
return df;
@@ -67,7 +66,7 @@ public class _DocumentFactories {
}
public TransformerFactory transformerFactory() {
- val tf = TransformerFactory.newInstance();
+ var tf = TransformerFactory.newInstance();
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); // XML transformers should be secured
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); // XML transformers should be secured
return tf;
@@ -78,7 +77,7 @@ public class _DocumentFactories {
}
public XMLInputFactory xmlInputFactory() {
- val xmlInputFactory = XMLInputFactory.newInstance();
+ var xmlInputFactory = XMLInputFactory.newInstance();
// disables DTDs entirely
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
@@ -90,7 +89,7 @@ public class _DocumentFactories {
public SAXBuilder saxBuilder() {
/*sonar-ignore-on*/
- val builder = new SAXBuilder();
+ var builder = new SAXBuilder();
/*sonar-ignore-off*/
builder.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
builder.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Arrays.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Arrays.java
index 10a9dc0344..93048c3df9 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Arrays.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Arrays.java
@@ -33,7 +33,6 @@ import org.apache.causeway.commons.internal.base._Casts;
import org.apache.causeway.commons.internal.base._NullSafe;
import lombok.NonNull;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -252,13 +251,13 @@ public final class _Arrays {
throw new IllegalArgumentException("Array must be of lenght 1 or larger.");
}
if(index<0 || index>=array.length) {
- val msg = String.format("Array index %d is out of bounds [0, %d]", index, array.length-1);
+ var msg = String.format("Array index %d is out of bounds [0, %d]", index, array.length-1);
throw new IllegalArgumentException(msg);
}
final T[] result = Arrays.copyOf(array, array.length - 1);
// copy the elements from index + 1 till end
// from original array to the new array
- val remaining = result.length - index;
+ var remaining = result.length - index;
System.arraycopy(array, index+1, result, index, remaining);
return result;
}
@@ -335,12 +334,12 @@ public final class _Arrays {
* @param index
*/
public static <T> Optional<T> get(final @Nullable T[] array, final int index) {
- val size = _NullSafe.size(array);
+ var size = _NullSafe.size(array);
if(size==0) {
return Optional.empty();
}
- val minIndex = 0;
- val maxIndex = size - 1;
+ var minIndex = 0;
+ var maxIndex = size - 1;
if(index < minIndex || index > maxIndex) {
return Optional.empty();
}
@@ -370,10 +369,10 @@ public final class _Arrays {
if (array == null) {
return null;
}
- val mappedArray = _Casts.<R[]>uncheckedCast(
+ var mappedArray = _Casts.<R[]>uncheckedCast(
Array.newInstance(resultElementType, array.length));
int i = 0;
- for (val element : array) {
+ for (var element : array) {
mappedArray[i++] = mapper.apply(element);
}
return mappedArray;
@@ -397,9 +396,9 @@ public final class _Arrays {
if (array == null) {
return null;
}
- val mappedArray = new Object[array.length];
+ var mappedArray = new Object[array.length];
int i = 0;
- for (val element : array) {
+ for (var element : array) {
mappedArray[i++] = mapper.apply(element);
}
return mappedArray;
@@ -426,10 +425,10 @@ public final class _Arrays {
if (collection == null) {
return null;
}
- val mappedArray = _Casts.<R[]>uncheckedCast(
+ var mappedArray = _Casts.<R[]>uncheckedCast(
Array.newInstance(resultElementType, collection.size()));
int i = 0;
- for (val element : collection) {
+ for (var element : collection) {
mappedArray[i++] = mapper.apply(element);
}
return mappedArray;
@@ -453,9 +452,9 @@ public final class _Arrays {
if (collection == null) {
return null;
}
- val mappedArray = new Object[collection.size()];
+ var mappedArray = new Object[collection.size()];
int i = 0;
- for (val element : collection) {
+ for (var element : collection) {
mappedArray[i++] = mapper.apply(element);
}
return mappedArray;
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Collections.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Collections.java
index 26837b9708..387e5feb65 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Collections.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Collections.java
@@ -44,7 +44,6 @@ import org.apache.causeway.commons.internal.base._NullSafe;
import org.apache.causeway.commons.internal.reflection._Generics;
import lombok.NonNull;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -277,7 +276,7 @@ public final class _Collections {
* it represents a collection and inference is possible.
*/
public static Optional<Class<?>> inferElementType(final @NonNull Parameter param) {
- val parameterType = param.getType();
+ var parameterType = param.getType();
return _Collections.isCollectionType(parameterType)
|| _Collections.isImmutableCollectionType(parameterType)
? _Generics.streamGenericTypeArgumentsOfParameter(param)
@@ -291,7 +290,7 @@ public final class _Collections {
* it represents a collection and inference is possible.
*/
public static Optional<Class<?>> inferElementType(final @NonNull Method method) {
- val returnType = method.getReturnType();
+ var returnType = method.getReturnType();
return _Collections.isCollectionType(returnType)
|| _Collections.isImmutableCollectionType(returnType)
? _Generics.streamGenericTypeArgumentsOfMethodReturnType(method)
@@ -304,7 +303,7 @@ public final class _Collections {
* it represents a collection and inference is possible.
*/
public static Optional<Class<?>> inferElementType(final @NonNull Field field) {
- val fieldType = field.getType();
+ var fieldType = field.getType();
return _Collections.isCollectionType(fieldType)
|| _Collections.isImmutableCollectionType(fieldType)
? _Generics.streamGenericTypeArgumentsOfField(field)
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Inbox.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Inbox.java
index 8c7d34434d..ef11b6d409 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Inbox.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Inbox.java
@@ -24,8 +24,6 @@ import java.util.List;
import org.apache.causeway.commons.collections.Can;
-import lombok.val;
-
/**
* Allows for thread-safe producer consumer pattern backed by {@link ArrayList}.
*
@@ -59,7 +57,7 @@ public class _Inbox<T> implements Serializable {
public Can<T> snapshotThenClear() {
synchronized($lock) {
- val defensiveCopy = Can.ofCollection(list);
+ var defensiveCopy = Can.ofCollection(list);
list.clear();
return defensiveCopy;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Lists.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Lists.java
index 92706eb777..be3e6858e1 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Lists.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Lists.java
@@ -36,7 +36,6 @@ import org.springframework.lang.Nullable;
import org.apache.causeway.commons.internal.base._NullSafe;
import lombok.NonNull;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -94,7 +93,7 @@ public final class _Lists {
if(_NullSafe.isEmpty(list)) {
return Collections.singletonList(element);
}
- val resultList = new ArrayList<T>(list.size() + 1);
+ var resultList = new ArrayList<T>(list.size() + 1);
resultList.addAll(list);
resultList.add(element);
return Collections.unmodifiableList(resultList);
@@ -105,8 +104,8 @@ public final class _Lists {
* list1 and list2.
*/
public <T> List<T> concat(final @Nullable List<T> list1, final @Nullable List<T> list2) {
- val isEmpty1 = _NullSafe.isEmpty(list1);
- val isEmpty2 = _NullSafe.isEmpty(list2);
+ var isEmpty1 = _NullSafe.isEmpty(list1);
+ var isEmpty2 = _NullSafe.isEmpty(list2);
if(isEmpty1) {
return isEmpty2
@@ -119,7 +118,7 @@ public final class _Lists {
return Collections.unmodifiableList(new ArrayList<T>(list1));
}
- val resultList = new ArrayList<T>(list1.size() + list2.size());
+ var resultList = new ArrayList<T>(list1.size() + list2.size());
resultList.addAll(list1);
resultList.addAll(list2);
return Collections.unmodifiableList(resultList);
@@ -151,14 +150,14 @@ public final class _Lists {
}
public <T> List<T> ofNullable(final @Nullable T e0, final @Nullable T e1) {
- val list = new ArrayList<T>(2);
+ var list = new ArrayList<T>(2);
list.add(e0);
list.add(e1);
return Collections.unmodifiableList(list);
}
public <T> List<T> ofNullable(final @Nullable T e0, final @Nullable T e1, final @Nullable T e2) {
- val list = new ArrayList<T>(3);
+ var list = new ArrayList<T>(3);
list.add(e0);
list.add(e1);
list.add(e2);
@@ -166,7 +165,7 @@ public final class _Lists {
}
public <T> List<T> ofNullable(final @Nullable T e0, final @Nullable T e1, final @Nullable T e2, final @Nullable T e3) {
- val list = new ArrayList<T>(4);
+ var list = new ArrayList<T>(4);
list.add(e0);
list.add(e1);
list.add(e2);
@@ -176,7 +175,7 @@ public final class _Lists {
public <T> List<T> ofNullable(final @Nullable T e0, final @Nullable T e1, final @Nullable T e2, final @Nullable T e3,
final @Nullable T e4) {
- val list = new ArrayList<T>(5);
+ var list = new ArrayList<T>(5);
list.add(e0);
list.add(e1);
list.add(e2);
@@ -187,7 +186,7 @@ public final class _Lists {
public <T> List<T> ofNullable(final @Nullable T e0, final @Nullable T e1, final @Nullable T e2, final @Nullable T e3,
final @Nullable T e4, final @Nullable T e5) {
- val list = new ArrayList<T>(6);
+ var list = new ArrayList<T>(6);
list.add(e0);
list.add(e1);
list.add(e2);
@@ -199,7 +198,7 @@ public final class _Lists {
public <T> List<T> ofNullable(final @Nullable T e0, final @Nullable T e1, final @Nullable T e2, final @Nullable T e3,
final @Nullable T e4, final @Nullable T e5, final @Nullable T e6) {
- val list = new ArrayList<T>(7);
+ var list = new ArrayList<T>(7);
list.add(e0);
list.add(e1);
list.add(e2);
@@ -212,7 +211,7 @@ public final class _Lists {
public <T> List<T> ofNullable(final @Nullable T e0, final @Nullable T e1, final @Nullable T e2, final @Nullable T e3,
final @Nullable T e4, final @Nullable T e5, final @Nullable T e6, final @Nullable T e7) {
- val list = new ArrayList<T>(8);
+ var list = new ArrayList<T>(8);
list.add(e0);
list.add(e1);
list.add(e2);
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Maps.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Maps.java
index 5a4e69001a..2c0577a8ab 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Maps.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Maps.java
@@ -43,7 +43,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.Value;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -171,7 +170,7 @@ public final class _Maps {
final @NonNull K key,
final @NonNull V value) {
- val newValue = map.compute(key, (k, v) -> (v==null) ? value : null);
+ var newValue = map.compute(key, (k, v) -> (v==null) ? value : null);
return newValue!=null;
}
@@ -182,7 +181,7 @@ public final class _Maps {
final @NonNull Supplier<Map<K, V1>> mapFactory,
final @NonNull Function<V0, V1> valueMapper) {
- val resultMap = mapFactory.get();
+ var resultMap = mapFactory.get();
if(input==null
|| input.isEmpty()) {
@@ -308,7 +307,7 @@ public final class _Maps {
@Override
public V get(final Object keyOrAliasKey) {
- val v = delegate.get(keyOrAliasKey);
+ var v = delegate.get(keyOrAliasKey);
if(v!=null) {
return v;
}
@@ -333,10 +332,10 @@ public final class _Maps {
private void putAliasKeys(final K key, final Can<K> aliasKeys, final boolean remap) {
if(aliasKeys.isNotEmpty()) {
- val keyPair = KeyPair.of(key, aliasKeys);
- for(val aliasKey : aliasKeys) {
+ var keyPair = KeyPair.of(key, aliasKeys);
+ for(var aliasKey : aliasKeys) {
- val existingKeyPair = pairByAliasKey.put(aliasKey, keyPair);
+ var existingKeyPair = pairByAliasKey.put(aliasKey, keyPair);
if(existingKeyPair!=null && !remap) {
throw _Exceptions.illegalArgument(
@@ -348,7 +347,7 @@ public final class _Maps {
}
private V getByAliasKey(final Object aliasKey) {
- val keyPair = pairByAliasKey.get(aliasKey);
+ var keyPair = pairByAliasKey.get(aliasKey);
if(keyPair!=null) {
return delegate.get(keyPair.getKey());
}
@@ -363,7 +362,7 @@ public final class _Maps {
//XXX this implementation is slow for large alias maps, since we traverse the entire map
pairByAliasKey.entrySet()
.removeIf(entry->{
- val keyPair = entry.getValue();
+ var keyPair = entry.getValue();
return keyPair.getKey().equals(key);
});
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Multimaps.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Multimaps.java
index 8382d979f2..2fc7c2c36e 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Multimaps.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Multimaps.java
@@ -45,7 +45,6 @@ import org.apache.causeway.commons.internal.base._Casts;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -233,7 +232,7 @@ public class _Multimaps {
@Override
public List<V> getOrElseNew(final K key) {
- val collection = delegate.computeIfAbsent(key, __->elementCollectionFactory.get());
+ var collection = delegate.computeIfAbsent(key, __->elementCollectionFactory.get());
return collection;
}
@@ -275,7 +274,7 @@ public class _Multimaps {
@Override
public Set<V> getOrElseNew(final K key) {
- val collection = delegate.computeIfAbsent(key, __->elementCollectionFactory.get());
+ var collection = delegate.computeIfAbsent(key, __->elementCollectionFactory.get());
return collection;
}
@@ -316,7 +315,7 @@ public class _Multimaps {
@Override
public Map<K2, V> getOrElseNew(final K1 key) {
- val elementMap = delegate.computeIfAbsent(key, __->elementMapFactory.get());
+ var elementMap = delegate.computeIfAbsent(key, __->elementMapFactory.get());
return elementMap;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_PrimitiveCollections.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_PrimitiveCollections.java
index 4e8f8a761f..e372378901 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_PrimitiveCollections.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_PrimitiveCollections.java
@@ -29,7 +29,6 @@ import org.springframework.lang.Nullable;
import org.apache.causeway.commons.internal.base._NullSafe;
import lombok.NoArgsConstructor;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -167,7 +166,7 @@ public class _PrimitiveCollections {
final int n = _NullSafe.size(indexes);
if(n==0) return new int[0];
- val newElements = new int[n];
+ var newElements = new int[n];
final int maxIndex = size()-1;
int elementCount = 0;
for(int index : indexes) {
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Sets.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Sets.java
index af76e5f57a..b72cf72546 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Sets.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/_Sets.java
@@ -42,7 +42,6 @@ import org.apache.causeway.commons.internal.base._NullSafe;
import static org.apache.causeway.commons.internal.functions._Predicates.not;
import lombok.NonNull;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -307,7 +306,7 @@ public final class _Sets {
return Collections.emptySet();
}
if(b==null || b.isEmpty()) {
- val copy = collectionFactory.get();
+ var copy = collectionFactory.get();
copy.addAll(a);
return Collections.unmodifiableSet(copy);
}
@@ -336,7 +335,7 @@ public final class _Sets {
return Collections.emptySortedSet();
}
if(b==null || b.isEmpty()) {
- val copy = collectionFactory.get();
+ var copy = collectionFactory.get();
copy.addAll(a);
return Collections.unmodifiableSortedSet(copy);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/collections/snapshot/_VersionedList.java b/commons/src/main/java/org/apache/causeway/commons/internal/collections/snapshot/_VersionedList.java
index cc4f464dbf..933ddec25e 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/collections/snapshot/_VersionedList.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/collections/snapshot/_VersionedList.java
@@ -29,7 +29,6 @@ import java.util.stream.Stream;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NonNull;
-import lombok.val;
/**
* Thread-safe pseudo list, that increments its version each time a snapshot is requested.
@@ -65,19 +64,19 @@ public final class _VersionedList<T> {
}
public void forEach(final Consumer<T> action) {
- for(val ver : versions) {
- for(val element : ver) {
+ for(var ver : versions) {
+ for(var element : ver) {
action.accept(element);
}
}
}
public void forEachParallel(final Consumer<T> action) {
- for(val ver : versions) {
+ for(var ver : versions) {
if(ver.size()>8) {
ver.parallelStream().forEach(action);
} else {
- for(val element : ver) {
+ for(var element : ver) {
action.accept(element);
}
}
@@ -102,8 +101,8 @@ public final class _VersionedList<T> {
synchronized(versions) {
commit();
- val from = snapshot.toIndex;
- val to = versions.size();
+ var from = snapshot.toIndex;
+ var to = versions.size();
return new Snapshot<>(uuid, from, to, defensiveCopy(from, to));
}
}
@@ -155,7 +154,7 @@ public final class _VersionedList<T> {
* @param action
*/
public void forEach(final Consumer<T> action) {
- val snapshot = snapshot();
+ var snapshot = snapshot();
snapshot.forEach(action);
Snapshot<T> delta = deltaSince(snapshot);
while(!delta.isEmpty()) {
@@ -169,7 +168,7 @@ public final class _VersionedList<T> {
* @param action
*/
public void forEachConcurrent(final Consumer<T> action) {
- val snapshot = snapshot();
+ var snapshot = snapshot();
snapshot.forEachParallel(action);
Snapshot<T> delta = deltaSince(snapshot);
while(!delta.isEmpty()) {
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/compare/_Comparators_SequenceCompare.java b/commons/src/main/java/org/apache/causeway/commons/internal/compare/_Comparators_SequenceCompare.java
index a61903dec8..2712fe4698 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/compare/_Comparators_SequenceCompare.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/compare/_Comparators_SequenceCompare.java
@@ -25,8 +25,6 @@ import org.springframework.lang.Nullable;
import org.apache.causeway.commons.internal.base._Strings;
import org.apache.causeway.commons.internal.primitives._Ints;
-import lombok.val;
-
/**
*
* package private mixin for utility class {@link _Comparators}
@@ -83,13 +81,13 @@ final class _Comparators_SequenceCompare {
}
// we have this component on each side
- val token1 = components1.nextToken();
- val token2 = components2.nextToken();
+ var token1 = components1.nextToken();
+ var token2 = components2.nextToken();
int componentCompare = 0;
- val int1 = _Ints.parseInt(token1, 10);
- val int2 = _Ints.parseInt(token2, 10);
+ var int1 = _Ints.parseInt(token1, 10);
+ var int2 = _Ints.parseInt(token2, 10);
if(int1.isPresent() && int2.isPresent()) {
componentCompare = Integer.compare(int1.getAsInt(), int2.getAsInt());
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTask.java b/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTask.java
index 0f7c4fca95..27054403e0 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTask.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTask.java
@@ -23,7 +23,6 @@ import java.util.function.Supplier;
import lombok.Getter;
import lombok.NonNull;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -55,7 +54,7 @@ public abstract class _ConcurrentTask<T> implements Runnable {
protected synchronized void preCall() {
if(startedAtNanos>0L) {
- val msg = String.format(
+ var msg = String.format(
"Cannot start task '%s' again, was already started before",
getName());
throw new IllegalStateException(msg);
@@ -85,7 +84,7 @@ public abstract class _ConcurrentTask<T> implements Runnable {
preCall();
try {
- val completedWith = innerCall();
+ var completedWith = innerCall();
postCall(completedWith, /*failedWith*/ null);
} catch (Throwable e) {
postCall(/*completedWith*/ null, e);
@@ -104,7 +103,7 @@ public abstract class _ConcurrentTask<T> implements Runnable {
public _ConcurrentTask<T> withName(final @NonNull String name) {
- val delegate = this;
+ var delegate = this;
return new _ConcurrentTask<T>() {
@@ -124,7 +123,7 @@ public abstract class _ConcurrentTask<T> implements Runnable {
public _ConcurrentTask<T> withName(final @NonNull Supplier<String> nameSupplier) {
- val delegate = this;
+ var delegate = this;
return new _ConcurrentTask<T>() {
@@ -187,7 +186,7 @@ public abstract class _ConcurrentTask<T> implements Runnable {
* see https://stackoverflow.com/a/36228195/9269480
*/
private void runWithContextClassLoader(final ClassLoader classLoader, final Runnable runnable) {
- val originalContextClassLoader = Thread.currentThread().getContextClassLoader();
+ var originalContextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
runnable.run();
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTaskList.java b/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTaskList.java
index d725365800..4b088034f4 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTaskList.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/concurrent/_ConcurrentTaskList.java
@@ -38,7 +38,6 @@ import org.apache.causeway.commons.internal.collections._Lists;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import lombok.val;
import lombok.extern.log4j.Log4j2;
@RequiredArgsConstructor(staticName = "named")
@@ -63,7 +62,7 @@ public class _ConcurrentTaskList {
public _ConcurrentTaskList addTask(final _ConcurrentTask<?> task) {
synchronized (tasks) {
if(wasStarted.get()) {
- val msg = "Tasks already started execution, can no longer modify collection of tasks!";
+ var msg = "Tasks already started execution, can no longer modify collection of tasks!";
throw new IllegalStateException(msg);
}
tasks.add(task);
@@ -74,7 +73,7 @@ public class _ConcurrentTaskList {
public _ConcurrentTaskList addTasks(final Collection<? extends _ConcurrentTask<?>> tasks) {
synchronized (this.tasks) {
if(wasStarted.get()) {
- val msg = "Tasks already started execution, can no longer modify collection of tasks!";
+ var msg = "Tasks already started execution, can no longer modify collection of tasks!";
throw new IllegalStateException(msg);
}
this.tasks.addAll(tasks);
@@ -88,13 +87,13 @@ public class _ConcurrentTaskList {
synchronized (tasks) {
if(wasStarted.get()) {
- val msg = "Tasks already started execution, can not start again!";
+ var msg = "Tasks already started execution, can not start again!";
throw new IllegalStateException(msg);
}
wasStarted.set(true);
}
- val t0 = System.nanoTime();
+ var t0 = System.nanoTime();
if(context.shouldRunSequential()) {
for(_ConcurrentTask<?> task : tasks) {
@@ -109,7 +108,7 @@ public class _ConcurrentTaskList {
// else run with executor ...
- val futures = new ArrayList<Future<?>>(tasks.size());
+ var futures = new ArrayList<Future<?>>(tasks.size());
for(_ConcurrentTask<?> task : tasks) {
futures.add(context.executorService.submit(task));
@@ -117,7 +116,7 @@ public class _ConcurrentTaskList {
// now wait for all futures to complete on a separate thread
- val thread = new Thread() {
+ var thread = new Thread() {
@Override
public void run() {
@@ -172,7 +171,7 @@ public class _ConcurrentTaskList {
private void onFinished(final _ConcurrentContext context) {
- for(val task: tasks) {
+ for(var task: tasks) {
if(task.getFailedWith()!=null) {
log.error("----------------------------------------");
log.error("Failed TaskList: " + this.getName());
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Debug.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Debug.java
index 409b2927ec..b5195ed390 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Debug.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Debug.java
@@ -24,7 +24,6 @@ import org.apache.causeway.commons.internal.base._NullSafe;
import org.apache.causeway.commons.internal.base._Strings;
import org.apache.causeway.commons.internal.debug.xray.XrayUi;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -85,7 +84,7 @@ public class _Debug {
if(x!=null
&& x.getClass().isArray()) {
- val array = _NullSafe.streamAutodetect(x)
+ var array = _NullSafe.streamAutodetect(x)
.map(e->""+e)
.collect(Collectors.joining(", "));
@@ -95,7 +94,7 @@ public class _Debug {
if(indent==0) {
System.err.printf("%s%n", x);
} else {
- val suffix = _Strings.padEnd("", indent, '-');
+ var suffix = _Strings.padEnd("", indent, '-');
System.err.printf("%s %s%n", suffix, x);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Probe.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Probe.java
index c01552d0f8..f0fa137aad 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Probe.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Probe.java
@@ -26,7 +26,6 @@ import java.util.stream.Collectors;
import org.apache.causeway.commons.internal.base._Strings;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
-import lombok.val;
import lombok.extern.log4j.Log4j2;
/**
@@ -167,8 +166,8 @@ public class _Probe {
}
public void warnNotImplementedYet(final String format, final Object... args) {
- val warnMsg = String.format(format, args);
- val restore_out = out;
+ var warnMsg = String.format(format, args);
+ var restore_out = out;
out=System.err;
println("WARN NotImplementedYet %s", warnMsg);
errOut("-------------------------------------");
@@ -178,9 +177,9 @@ public class _Probe {
}
public void run(final Runnable runnable) {
- val t0 = System.nanoTime();
+ var t0 = System.nanoTime();
runnable.run();
- val nanos = System.nanoTime() - t0;
+ var nanos = System.nanoTime() - t0;
nanoCounter.add(nanos);
println("total runtime %d ms", nanoCounter.longValue()/1000_000);
}
@@ -201,7 +200,7 @@ public class _Probe {
// -- CONVENIENT DEBUG TOOLS (STATIC)
public static String currentThreadId() {
- val ct = Thread.currentThread();
+ var ct = Thread.currentThread();
return String.format("Thread[%s (%d)])", ct.getName(), ct.getId());
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Xray.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Xray.java
index 7f9ff1558b..ac6aaca657 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Xray.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_Xray.java
@@ -27,7 +27,6 @@ import org.apache.causeway.commons.internal.debug.xray.XrayModel.Stickiness;
import org.apache.causeway.commons.internal.debug.xray.XrayModel.ThreadMemento;
import org.apache.causeway.commons.internal.debug.xray.XrayUi;
-import lombok.val;
import lombok.experimental.UtilityClass;
@UtilityClass
@@ -42,13 +41,13 @@ final class _Xray {
return;
}
- val threadId = ThreadMemento.fromCurrentThread();
- val timeStamp = LocalDateTime.now();
+ var threadId = ThreadMemento.fromCurrentThread();
+ var timeStamp = LocalDateTime.now();
XrayUi.updateModel(model->{
- val parentNode = model.getThreadNode(threadId);
+ var parentNode = model.getThreadNode(threadId);
- val logModel = model.addDataNode(parentNode,
+ var logModel = model.addDataNode(parentNode,
new XrayDataModel.LogEntry(
"debug-log", timeStamp, icon.getResourcePath(),
_Strings.ellipsifyAtEnd(logMessage, 80, "..."),
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_XrayEvent.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_XrayEvent.java
index f1c308ad99..adea4ab5ba 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/_XrayEvent.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/_XrayEvent.java
@@ -26,7 +26,6 @@ import org.apache.causeway.commons.internal.base._NullSafe;
import org.apache.causeway.commons.internal.debug.xray.XrayUi;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -88,7 +87,7 @@ public class _XrayEvent {
* @param depthLimit - max call stack depth printed out to console
*/
void record(final int depthLimit, final _IconResource icon, final String format, final Object...args) {
- val stackTrace = _Exceptions.streamStackTrace()
+ var stackTrace = _Exceptions.streamStackTrace()
.skip(3)
.filter(_XrayEvent::accept)
.collect(Can.toCan());
@@ -107,7 +106,7 @@ public class _XrayEvent {
_Xray.recordDebugLogEvent(icon, logMessage, stackTrace);
- val context = String.format("%s|| %s",
+ var context = String.format("%s|| %s",
Thread.currentThread().getName(),
stackTrace.stream()
.limit(depthLimit)
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/swt/_Swt.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/swt/_Swt.java
index 84796c8ea0..313f2b39c3 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/swt/_Swt.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/swt/_Swt.java
@@ -27,7 +27,6 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
-import lombok.val;
import lombok.experimental.UtilityClass;
@UtilityClass
@@ -47,10 +46,10 @@ public class _Swt {
*/
public void prompt(final String message) {
- val awaitableLatch = new CountDownLatch(1);
+ var awaitableLatch = new CountDownLatch(1);
SwingUtilities.invokeLater(()->{
- val frame = new JFrame();
+ var frame = new JFrame();
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(new JLabel(message));
frame.pack();
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayDataModel.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayDataModel.java
index 8fdb9d341d..87733077aa 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayDataModel.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayDataModel.java
@@ -45,7 +45,6 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
-import lombok.val;
public abstract class XrayDataModel extends HasIdAndLabel {
@@ -78,16 +77,16 @@ public abstract class XrayDataModel extends HasIdAndLabel {
String[] columnNames = {"Key", "Value"};
Object[][] tableData = new Object[data.size()][columnNames.length];
- val rowIndex = _Refs.intRef(0);
+ var rowIndex = _Refs.intRef(0);
data.forEach((k, v)->{
- val row = tableData[rowIndex.getValue()];
+ var row = tableData[rowIndex.getValue()];
rowIndex.incAndGet();
row[0] = k;
row[1] = v;
});
- val table = _SwingUtil.newTable(tableData, columnNames);
+ var table = _SwingUtil.newTable(tableData, columnNames);
table.setFillsViewportHeight(true);
panel.setViewportView(table);
@@ -113,18 +112,18 @@ public abstract class XrayDataModel extends HasIdAndLabel {
@Override
public void render(final JScrollPane panel) {
- val layout = new BorderLayout();
- val panel2 = new JPanel(layout);
+ var layout = new BorderLayout();
+ var panel2 = new JPanel(layout);
layout.setHgap(10);
layout.setVgap(10);
// log message label
- val logMessagePane = new JEditorPane();
+ var logMessagePane = new JEditorPane();
logMessagePane.setEditable(false);
logMessagePane.setText(logMessage);
- val timestampLabel = new JLabel(timestamp.format(_Temporals.DEFAULT_LOCAL_DATETIME_FORMATTER_WITH_MILLIS));
+ var timestampLabel = new JLabel(timestamp.format(_Temporals.DEFAULT_LOCAL_DATETIME_FORMATTER_WITH_MILLIS));
panel2.add(
_SwingUtil.verticalBox(
@@ -137,16 +136,16 @@ public abstract class XrayDataModel extends HasIdAndLabel {
String[] columnNames = {"", "StackTraceElement"};
Object[][] tableData = new Object[data.size()][columnNames.length];
- val rowIndex = _Refs.intRef(0);
+ var rowIndex = _Refs.intRef(0);
data.forEach(IndexedConsumer.offset(1, (index, se)->{
- val row = tableData[rowIndex.getValue()];
+ var row = tableData[rowIndex.getValue()];
rowIndex.incAndGet();
row[0] = index;
row[1] = se.toString();
}));
- val table = _SwingUtil.newTable(tableData, columnNames);
+ var table = _SwingUtil.newTable(tableData, columnNames);
table.setFillsViewportHeight(true);
panel2.add(table, BorderLayout.CENTER);
@@ -187,13 +186,13 @@ public abstract class XrayDataModel extends HasIdAndLabel {
@Override
public void render(final JScrollPane panel) {
- val canvas = _SwingUtil.canvas(g->{
+ var canvas = _SwingUtil.canvas(g->{
g.setColor(BACKGROUND_COLOR);
g.fill(g.getClip());
data.render(g);
});
- val dim = data.layout((Graphics2D)panel.getGraphics());
+ var dim = data.layout((Graphics2D)panel.getGraphics());
if(BORDER_COLOR!=null) {
canvas.setBorder(BorderFactory.createLineBorder(BORDER_COLOR));
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModel.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModel.java
index 7da5fe0fe1..11dcbb69e2 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModel.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModel.java
@@ -30,7 +30,6 @@ import org.springframework.lang.Nullable;
import org.apache.causeway.commons.internal.base._Strings;
import lombok.Value;
-import lombok.val;
public interface XrayModel {
@@ -101,7 +100,7 @@ public interface XrayModel {
private final String multilinelabel;
public static ThreadMemento fromCurrentThread() {
- val ct = Thread.currentThread();
+ var ct = Thread.currentThread();
return ThreadMemento.of(
String.format("thread-%d-%s", ct.getId(), ct.getName()),
String.format("Thread-%d [%s]", ct.getId(), ct.getName()),
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModelSimple.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModelSimple.java
index 63f5795fde..2575edf4c2 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModelSimple.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayModelSimple.java
@@ -30,7 +30,6 @@ import org.apache.causeway.commons.internal.collections._Maps;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
-import lombok.val;
@RequiredArgsConstructor
final class XrayModelSimple implements XrayModel {
@@ -44,7 +43,7 @@ final class XrayModelSimple implements XrayModel {
final @NonNull String name,
final @NonNull String id,
final @NonNull Stickiness stickiness) {
- val newNode = new DefaultMutableTreeNode();
+ var newNode = new DefaultMutableTreeNode();
newNode.setUserObject(new HasIdAndLabel() {
@Override public String getId() { return id; }
@Override public String getLabel() { return name; }
@@ -59,7 +58,7 @@ final class XrayModelSimple implements XrayModel {
public <T extends XrayDataModel> T addDataNode(
final @NonNull MutableTreeNode parent,
final @NonNull T dataModel) {
- val newNode = new DefaultMutableTreeNode();
+ var newNode = new DefaultMutableTreeNode();
newNode.setUserObject(dataModel);
((DefaultMutableTreeNode)parent).add(newNode);
nodesById.put(dataModel.getId(), newNode);
@@ -75,7 +74,7 @@ final class XrayModelSimple implements XrayModel {
@Override
public void remove(final MutableTreeNode node) {
- val hasId = (HasIdAndLabel) ((DefaultMutableTreeNode)node).getUserObject();
+ var hasId = (HasIdAndLabel) ((DefaultMutableTreeNode)node).getUserObject();
nodesById.remove(hasId.getId());
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayUi.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayUi.java
index e9e86f47c8..37c3bc2a97 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayUi.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/XrayUi.java
@@ -65,7 +65,6 @@ import org.apache.causeway.commons.internal.debug.xray.XrayModel.HasIdAndLabel;
import org.apache.causeway.commons.internal.debug.xray.XrayModel.Stickiness;
import lombok.RequiredArgsConstructor;
-import lombok.val;
public class XrayUi extends JFrame {
@@ -80,7 +79,7 @@ public class XrayUi extends JFrame {
private static CountDownLatch latch = null;
public static void start(final int defaultCloseOperation) {
- val alreadyRequested = startRequested.getAndSet(true);
+ var alreadyRequested = startRequested.getAndSet(true);
if(!alreadyRequested) {
latch = new CountDownLatch(1);
SwingUtilities.invokeLater(()->new XrayUi(defaultCloseOperation));
@@ -128,23 +127,23 @@ public class XrayUi extends JFrame {
tree.setShowsRootHandles(false);
- val detailPanel = layoutUIAndGetDetailPanel(tree);
+ var detailPanel = layoutUIAndGetDetailPanel(tree);
tree.getSelectionModel().addTreeSelectionListener((final TreeSelectionEvent e) -> {
- val selPath = e.getNewLeadSelectionPath();
+ var selPath = e.getNewLeadSelectionPath();
if(selPath==null) {
return; // ignore event
}
- val selectedNode = (DefaultMutableTreeNode) selPath.getLastPathComponent();
- val userObject = selectedNode.getUserObject();
+ var selectedNode = (DefaultMutableTreeNode) selPath.getLastPathComponent();
+ var userObject = selectedNode.getUserObject();
//detailPanel.removeAll();
if(userObject instanceof XrayDataModel) {
((XrayDataModel) userObject).render(detailPanel);
} else {
- val infoPanel = new JPanel();
+ var infoPanel = new JPanel();
infoPanel.add(new JLabel("Details"));
detailPanel.setViewportView(infoPanel);
}
@@ -155,9 +154,9 @@ public class XrayUi extends JFrame {
//System.out.println("selected: " + selectedNode.toString());
});
- val popupMenu = new JPopupMenu();
+ var popupMenu = new JPopupMenu();
- val clearThreadsAction = popupMenu.add(new JMenuItem("Clear Threads"));
+ var clearThreadsAction = popupMenu.add(new JMenuItem("Clear Threads"));
clearThreadsAction.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
@@ -165,7 +164,7 @@ public class XrayUi extends JFrame {
}
});
- val callStackMergeAction = popupMenu.add(new JMenuItem("Merge Logged Call-Stack"));
+ var callStackMergeAction = popupMenu.add(new JMenuItem("Merge Logged Call-Stack"));
callStackMergeAction.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
@@ -173,7 +172,7 @@ public class XrayUi extends JFrame {
}
});
- val deleteAction = popupMenu.add(new JMenuItem("Delete"));
+ var deleteAction = popupMenu.add(new JMenuItem("Delete"));
deleteAction.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
@@ -221,8 +220,8 @@ public class XrayUi extends JFrame {
// report key bindings to the UI
{
- val root = xrayModel.getRootNode();
- val env = xrayModel.addDataNode(root,
+ var root = xrayModel.getRootNode();
+ var env = xrayModel.addDataNode(root,
new XrayDataModel.KeyValue("causeway-xray-keys", "X-ray Keybindings", Stickiness.CANNOT_DELETE_NODE));
env.getData().put("F5", "Clear Threads");
env.getData().put("DELETE", "Delete Selected Nodes");
@@ -281,8 +280,8 @@ public class XrayUi extends JFrame {
}
private void doClearThreads(){
- val root = (DefaultMutableTreeNode) tree.getModel().getRoot();
- val threadNodes = streamChildrenOf(root)
+ var root = (DefaultMutableTreeNode) tree.getModel().getRoot();
+ var threadNodes = streamChildrenOf(root)
.filter(node->extractUserObject(node)
.map(HasIdAndLabel::getId)
.map(id->id.startsWith("thread-"))
@@ -297,7 +296,7 @@ public class XrayUi extends JFrame {
}
private void doMergeCallStacksOnSelectedNodes() {
- val logEntries = streamSelectedNodes()
+ var logEntries = streamSelectedNodes()
.filter(node->node.getUserObject() instanceof XrayDataModel.LogEntry)
.map(node->(XrayDataModel.LogEntry)node.getUserObject())
.collect(Can.toCan());
@@ -307,13 +306,13 @@ public class XrayUi extends JFrame {
return;
}
- val callStackMerger = new _CallStackMerger(logEntries);
+ var callStackMerger = new _CallStackMerger(logEntries);
JFrame frame = new JFrame("Merged Log View");
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setOpaque(true);
-// val canvas = _SwingUtil.canvas(g->{
+// var canvas = _SwingUtil.canvas(g->{
// g.setColor(Color.GRAY);
// g.fill(g.getClip());
// callStackMerger.render(g);
@@ -346,7 +345,7 @@ public class XrayUi extends JFrame {
JScrollPane detailScrollPane = new JScrollPane();
//Create a split pane with the two scroll panes in it.
- val splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
+ var splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
masterScrollPane, detailScrollPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(260);
@@ -388,13 +387,13 @@ public class XrayUi extends JFrame {
final int row,
final boolean hasFocus) {
- val label = (DefaultTreeCellRenderer)
+ var label = (DefaultTreeCellRenderer)
delegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
Object o = ((DefaultMutableTreeNode) value).getUserObject();
if (o instanceof XrayDataModel) {
XrayDataModel dataModel = (XrayDataModel) o;
- val imageIcon = iconCache.computeIfAbsent(dataModel.getIconResource(), iconResource->{
+ var imageIcon = iconCache.computeIfAbsent(dataModel.getIconResource(), iconResource->{
URL imageUrl = getClass().getResource(dataModel.getIconResource());
return Optional.ofNullable(imageUrl)
.map(ImageIcon::new);
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_CallStackMerger.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_CallStackMerger.java
index 37718be0a8..00327dd4ef 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_CallStackMerger.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_CallStackMerger.java
@@ -36,7 +36,6 @@ import org.apache.causeway.commons.internal.debug.xray.graphics.CallStackDiagram
import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.RequiredArgsConstructor;
-import lombok.val;
@RequiredArgsConstructor
final class _CallStackMerger {
@@ -73,12 +72,12 @@ final class _CallStackMerger {
}
void visitDepthFirst(final IntTreeVisitor visitor) {
visitor.accept(level, value);
- for(val child : children) {
+ for(var child : children) {
child.visitDepthFirst(visitor);
}
}
void visitBreadthFirst(final IntTreeVisitor visitor) {
- val queue = new ArrayDeque<IntTreeNode>();
+ var queue = new ArrayDeque<IntTreeNode>();
queue.add(this);
IntTreeNode currentNode;
while (!queue.isEmpty()) {
@@ -94,7 +93,7 @@ final class _CallStackMerger {
}
private StringBuilder print(final IntFunction<String> valueMapper) {
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
print(valueMapper, sb, "", "");
return sb;
}
@@ -118,18 +117,18 @@ final class _CallStackMerger {
private void initialize() {
- val executionNodeSet = _Sets.<String>newHashSet(); // temporary helper
- val executionNodeMap = _Maps.<Integer, String>newHashMap(); // StackStraceElement by unique id
+ var executionNodeSet = _Sets.<String>newHashSet(); // temporary helper
+ var executionNodeMap = _Maps.<Integer, String>newHashMap(); // StackStraceElement by unique id
- val executionLanes = new ArrayList<int[]>();
+ var executionLanes = new ArrayList<int[]>();
logEntries.forEach(logEntry->{
- val executionLane = new int[logEntry.getData().size()];
+ var executionLane = new int[logEntry.getData().size()];
executionLanes.add(executionLane);
Can.ofCollection(logEntry.getData()).reverse().stream()
.map(StackTraceElement::toString).forEach(IndexedConsumer.zeroBased((index, se)->{
- val isNew = executionNodeSet.add(se);
+ var isNew = executionNodeSet.add(se);
if(isNew) {
final int id = executionNodeSet.size();
executionNodeMap.put(id, se);
@@ -145,7 +144,7 @@ final class _CallStackMerger {
}));
});
- val root = merge(executionLanes);
+ var root = merge(executionLanes);
callStackDiagram = new CallStackDiagram(root.print(id->{
return _Exceptions.abbreviate(
executionNodeMap.getOrDefault(id, "root"),
@@ -161,11 +160,11 @@ final class _CallStackMerger {
* ...
*/
static IntTreeNode merge(final List<int[]> executionLanes) {
- val root = IntTreeNode.newRoot(-1);
+ var root = IntTreeNode.newRoot(-1);
executionLanes.forEach(lane->{
var node = root;
for(int id : lane) {
- val equalNode = node.children.stream().filter(child->child.value==id).findAny();
+ var equalNode = node.children.stream().filter(child->child.value==id).findAny();
if(!equalNode.isPresent()) {
node = node.addChild(id);
} else {
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_SwingUtil.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_SwingUtil.java
index 0a4cd245a2..d7b28a441a 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_SwingUtil.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/_SwingUtil.java
@@ -35,14 +35,13 @@ import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
-import lombok.val;
import lombok.experimental.UtilityClass;
@UtilityClass
final class _SwingUtil {
JTable newTable(final Object[][] tableData, final String[] columnNames) {
- val table = new JTable(tableData, columnNames) {
+ var table = new JTable(tableData, columnNames) {
private static final long serialVersionUID = 1L;
@Override
public Component prepareRenderer(final TableCellRenderer renderer, final int row, final int column) {
@@ -69,7 +68,7 @@ final class _SwingUtil {
if (!expanded && node.isRoot()) {
return;
}
- val path = new TreePath(node.getPath());
+ var path = new TreePath(node.getPath());
if (expanded) {
tree.expandPath(path);
} else {
@@ -79,7 +78,7 @@ final class _SwingUtil {
JPanel canvas(final Consumer<Graphics2D> onRender) {
- val canvas = new JPanel() {
+ var canvas = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
public void paintComponent(final Graphics g) {
@@ -92,14 +91,14 @@ final class _SwingUtil {
public static Component verticalBox(final Component ...components) {
- val panel = new JPanel(new GridBagLayout());
- val gbc = new GridBagConstraints();
+ var panel = new JPanel(new GridBagLayout());
+ var gbc = new GridBagConstraints();
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.insets = new Insets(3, 6, 3, 6);
- for(val component : components) {
+ for(var component : components) {
panel.add(component, gbc);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/SequenceDiagram.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/SequenceDiagram.java
index 8191ca9a20..0f91afbe4b 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/SequenceDiagram.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/SequenceDiagram.java
@@ -38,7 +38,6 @@ import org.apache.causeway.commons.internal.primitives._Ints;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
-import lombok.val;
public class SequenceDiagram {
@@ -56,14 +55,14 @@ public class SequenceDiagram {
}
public void enter(final @NonNull String from, final @NonNull String to, final String label) {
- val p0 = participant(from);
- val p1 = participant(to);
+ var p0 = participant(from);
+ var p1 = participant(to);
connections.add(newConnection(p0, p1, label, false));
}
public void exit(final @NonNull String from, final @NonNull String to, final String label) {
- val p1 = participant(to);
- val p0 = participant(from);
+ var p1 = participant(to);
+ var p0 = participant(from);
connections.add(newConnection(p0, p1, label, true));
}
@@ -76,14 +75,14 @@ public class SequenceDiagram {
}
public void activate(final String participantId) {
- val participant = participant(participantId);
- val latestConnection = latestConnection();
+ var participant = participant(participantId);
+ var latestConnection = latestConnection();
lifelines.add(new Lifeline(participant, latestConnection));
}
public void deactivate(final String participantId) {
- val participant = participant(participantId);
- val latestConnection = latestConnection();
+ var participant = participant(participantId);
+ var latestConnection = latestConnection();
Can.ofCollection(lifelines).reverse().stream()
.filter(lifeline->lifeline.getParticipant().equals(participant))
.findFirst()
@@ -191,11 +190,11 @@ public class SequenceDiagram {
x_from = from.getX_middle();
x_to = to.getX_middle();
- val fromConnectsLifeline = lifelines.stream()
+ var fromConnectsLifeline = lifelines.stream()
.filter(ll->ll.getParticipant().equals(from))
.anyMatch(ll->ll.overlaps(this));
- val toConnectsLifeline = lifelines.stream()
+ var toConnectsLifeline = lifelines.stream()
.filter(ll->ll.getParticipant().equals(to))
.anyMatch(ll->ll.overlaps(this));
@@ -217,7 +216,7 @@ public class SequenceDiagram {
x_left,
y_top);
- val dim = textBlock.layout(g.getFontMetrics(),
+ var dim = textBlock.layout(g.getFontMetrics(),
CONNECTION_LABEL_PADDING_H,
CONNECTION_LABEL_PADDING_V,
CONNECTION_LABEL_LINEGAP,
@@ -251,7 +250,7 @@ public class SequenceDiagram {
textBlock = new TextBlock(label, x_left, y_top);
- val dim = textBlock.layout(g.getFontMetrics(),
+ var dim = textBlock.layout(g.getFontMetrics(),
PARTICIPANT_PADDING_H,
PARTICIPANT_PADDING_V,
PARTICIPANT_LINEGAP,
@@ -299,10 +298,10 @@ public class SequenceDiagram {
}
public boolean overlaps(final Connection connection) {
- val lowerBound = _Ints.Bound.inclusive(startAt != null
+ var lowerBound = _Ints.Bound.inclusive(startAt != null
? startAt.index
: -1);
- val upperBound = _Ints.Bound.inclusive(endAt !=null
+ var upperBound = _Ints.Bound.inclusive(endAt !=null
? endAt.index
: Integer.MAX_VALUE);
return _Ints.Range.of(lowerBound, upperBound).contains(connection.index);
@@ -314,8 +313,8 @@ public class SequenceDiagram {
PARTICIPANT_FONT.ifPresent(g::setFont);
- val x_offset = _Refs.intRef(PARTICIPANT_MARGIN_H);
- val y_offset = _Refs.intRef(0);
+ var x_offset = _Refs.intRef(PARTICIPANT_MARGIN_H);
+ var y_offset = _Refs.intRef(0);
participantsById.values().stream()
.peek(p->p.layout(g, x_offset))
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/_Graphics.java b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/_Graphics.java
index 4850c0ce67..c7520cd425 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/_Graphics.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/debug/xray/graphics/_Graphics.java
@@ -37,7 +37,6 @@ import org.apache.causeway.commons.io.TextUtils;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import lombok.val;
final class _Graphics {
@@ -54,7 +53,7 @@ final class _Graphics {
2f);
static Optional<Font> lookupFont(final String fontName, final float size) {
- val ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ var ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
for (Font font : ge.getAllFonts()) {
if(font.getFontName().equals(fontName)) {
return Optional.of(font.deriveFont(size));
@@ -71,7 +70,7 @@ final class _Graphics {
final int dir = m1<m0 ? 1 : -1;
- val origStroke = g.getStroke();
+ var origStroke = g.getStroke();
g.setStroke(STROKE_DEFAULT);
for(int i=0; i<7; ++i) {
g.drawLine(m1 + i*dir, y, m1 + 8*dir, y - 3);
@@ -143,8 +142,8 @@ final class _Graphics {
|| lines.isEmpty()) {
return;
}
- val textLeft = xLeft + hPadding;
- val baseLine = _Refs.intRef(yTop + vPadding + lineAscent);
+ var textLeft = xLeft + hPadding;
+ var baseLine = _Refs.intRef(yTop + vPadding + lineAscent);
lines.forEach(line->{
g.drawString(line, textLeft, baseLine.getValue());
baseLine.update(x->x + lineHeight + lineGap);
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/delegate/_Delegate.java b/commons/src/main/java/org/apache/causeway/commons/internal/delegate/_Delegate.java
index fc3d0db923..8b09612496 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/delegate/_Delegate.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/delegate/_Delegate.java
@@ -30,7 +30,6 @@ import org.springframework.util.ClassUtils;
import org.apache.causeway.commons.internal.reflection._ClassCache;
import lombok.RequiredArgsConstructor;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -90,7 +89,7 @@ public class _Delegate {
// Invoke method with same signature on delegate ()
try {
- val delegateMethod =
+ var delegateMethod =
classCache.lookupResolvedMethodElseFail(delegate.getClass(),
method.getName(), method.getParameterTypes());
return delegateMethod.method().invoke(delegate, args);
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/exceptions/_Exceptions.java b/commons/src/main/java/org/apache/causeway/commons/internal/exceptions/_Exceptions.java
index 76382208ba..026fbbcc35 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/exceptions/_Exceptions.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/exceptions/_Exceptions.java
@@ -38,7 +38,6 @@ import org.apache.causeway.commons.internal.collections._Lists;
import org.apache.causeway.commons.io.TextUtils;
import lombok.NonNull;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -212,8 +211,8 @@ public final class _Exceptions {
if(_Strings.isNotEmpty(ex.getMessage())) {
return ex.getMessage();
}
- val sb = new StringBuilder();
- val nestedMsg = streamCausalChain(ex)
+ var sb = new StringBuilder();
+ var nestedMsg = streamCausalChain(ex)
.peek(throwable->{
sb.append(throwable.getClass().getSimpleName()).append("/");
})
@@ -374,7 +373,7 @@ public final class _Exceptions {
if(ex==null) {
return Stream.empty();
}
- val chain = getCausalChain(ex);
+ var chain = getCausalChain(ex);
return chain.stream();
}
@@ -404,8 +403,8 @@ public final class _Exceptions {
public static void silence(final Runnable runnable) {
- val currentThread = Thread.currentThread();
- val silencedHandler = currentThread.getUncaughtExceptionHandler();
+ var currentThread = Thread.currentThread();
+ var silencedHandler = currentThread.getUncaughtExceptionHandler();
currentThread.setUncaughtExceptionHandler((final Thread t, final Throwable e)->{/*noop*/});
@@ -426,7 +425,7 @@ public final class _Exceptions {
if(throwable==null) {
return false;
}
- val throwableMessage = throwable.getMessage();
+ var throwableMessage = throwable.getMessage();
if(throwableMessage == null || _NullSafe.isEmpty(messages)) {
return false;
}
@@ -451,19 +450,19 @@ public final class _Exceptions {
);
public static String abbreviate(final String className, final String...compress) {
- val str = className;
+ var str = className;
return Stream.concat(
_NullSafe.stream(compress).map(prefix->Map.entry(prefix, "")),
packageReplacements.entrySet().stream()
)
.filter(entry->str.startsWith(entry.getKey()))
.map(entry->{
- val replacement = entry.getValue();
+ var replacement = entry.getValue();
var s = str;
s = s.replace(entry.getKey() + ".", replacement.isEmpty() ? "{" : replacement + ".");
- val cutter = TextUtils.cutter(s);
- val left = cutter.keepBefore(".").getValue();
- val right = cutter.keepAfter(".").getValue();
+ var cutter = TextUtils.cutter(s);
+ var left = cutter.keepBefore(".").getValue();
+ var right = cutter.keepAfter(".").getValue();
s = replacement.isEmpty()
? left + "}." + right
: left + "." + right;
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/html/_BootstrapBadge.java b/commons/src/main/java/org/apache/causeway/commons/internal/html/_BootstrapBadge.java
index 7bcd931332..87c981c17d 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/html/_BootstrapBadge.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/html/_BootstrapBadge.java
@@ -27,7 +27,6 @@ import org.apache.causeway.commons.internal.base._Strings;
import lombok.Builder;
import lombok.Singular;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
* <p>
@@ -63,7 +62,7 @@ public class _BootstrapBadge {
*/
public String noLink() {
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
sb
.append("<span ")
.append("class=\"")
@@ -102,7 +101,7 @@ public class _BootstrapBadge {
*/
public String link() {
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
sb
.append("<a ")
.append("class=\"")
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/image/_Images.java b/commons/src/main/java/org/apache/causeway/commons/internal/image/_Images.java
index 717b455807..8ce843af90 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/image/_Images.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/image/_Images.java
@@ -38,7 +38,6 @@ import org.apache.causeway.commons.internal.primitives._Ints;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
public class _Images {
@@ -46,7 +45,7 @@ public class _Images {
@SneakyThrows
public static byte[] toBytes(final @NonNull BufferedImage image){
- try(val bos = new ByteArrayOutputStream(8 * 1024)) {
+ try(var bos = new ByteArrayOutputStream(8 * 1024)) {
ImageIO.write(image, "png", bos); // png is lossless
return bos.toByteArray();
}
@@ -54,7 +53,7 @@ public class _Images {
@SneakyThrows
public static BufferedImage fromBytes(final @NonNull byte[] imageData){
- try(val bis = new ByteArrayInputStream(imageData)){
+ try(var bis = new ByteArrayInputStream(imageData)){
return ImageIO.read(bis);
}
}
@@ -69,7 +68,7 @@ public class _Images {
@SneakyThrows
public static BufferedImage fromBase64(final @NonNull String base64ImageData){
- val imageData = _Bytes.ofUrlBase64.apply(base64ImageData.getBytes(StandardCharsets.UTF_8));
+ var imageData = _Bytes.ofUrlBase64.apply(base64ImageData.getBytes(StandardCharsets.UTF_8));
return fromBytes(imageData);
}
@@ -90,7 +89,7 @@ public class _Images {
final int width = image.getWidth();
final int height = image.getHeight();
- val pixels = new int[height][width];
+ var pixels = new int[height][width];
for(int lineIndex=0; lineIndex<height; ++lineIndex) {
image.getRGB(0, lineIndex, width, 1, pixels[lineIndex], 0, width);
@@ -122,7 +121,7 @@ public class _Images {
if(pixelCount>0) {
// internally clones pixel data
- val raster = createRasterARGB8888(pixels);
+ var raster = createRasterARGB8888(pixels);
return createImageARGB8888(raster);
} else {
return null;
@@ -138,14 +137,14 @@ public class _Images {
}
private static WritableRaster createRasterARGB8888(final int width, final int height, final int[] dataArray){
- val dataBuffer = new DataBufferInt(dataArray, width * height);
- val sampleModel = new SinglePixelPackedSampleModel(
+ var dataBuffer = new DataBufferInt(dataArray, width * height);
+ var sampleModel = new SinglePixelPackedSampleModel(
dataBuffer.getDataType(), width, height, BitMask8888);
return Raster.createWritableRaster(sampleModel, dataBuffer, null);
}
private static BufferedImage createImageARGB8888(final WritableRaster raster){
- val directColorModel​ =
+ var directColorModel​ =
new DirectColorModel(32, BitMask8888[0], BitMask8888[1], BitMask8888[2], BitMask8888[3]);
return new BufferedImage(directColorModel​, raster, false, null);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer.java b/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer.java
index 0a82d254f7..9f5276ad26 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer.java
@@ -30,7 +30,6 @@ import org.apache.causeway.commons.collections.Cardinality;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -115,7 +114,7 @@ public interface _IocContainer {
*/
default <T> T getSingletonElseFail(final @NonNull Class<T> type) {
- val candidates = select(type);
+ var candidates = select(type);
if (candidates.getCardinality() == Cardinality.ZERO) {
throw _Exceptions.noSuchElement("Cannot resolve singleton '%s'", type);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer_Spring.java b/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer_Spring.java
index aee1f1d3ad..d7e3be5ff4 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer_Spring.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/ioc/_IocContainer_Spring.java
@@ -38,7 +38,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
-import lombok.val;
/**
* Spring specific implementation of _IocContainer (package private)
@@ -52,7 +51,7 @@ final class _IocContainer_Spring implements _IocContainer {
@Override
public <T> Optional<T> get(final @NonNull Class<T> requiredType) {
- val provider = springContext.getBeanProvider(requiredType);
+ var provider = springContext.getBeanProvider(requiredType);
try {
return Optional.ofNullable(provider.getIfUnique());
} catch (Exception cause) {
@@ -64,8 +63,8 @@ final class _IocContainer_Spring implements _IocContainer {
public Stream<_SingletonBeanProvider> streamAllBeans() {
return Stream.of(springContext.getBeanDefinitionNames())
.map(name->{
- val type = ClassUtils.getUserClass(springContext.getType(name));
- val beanAdapter = _SingletonBeanProvider.of(name, type, ()->springContext.getBean(name));
+ var type = ClassUtils.getUserClass(springContext.getType(name));
+ var beanAdapter = _SingletonBeanProvider.of(name, type, ()->springContext.getBean(name));
return beanAdapter;
});
}
@@ -84,7 +83,7 @@ final class _IocContainer_Spring implements _IocContainer {
@Override
public <T> Can<T> select(final @NonNull Class<T> requiredType) {
- val allMatchingBeans = springContext.getBeanProvider(requiredType)
+ var allMatchingBeans = springContext.getBeanProvider(requiredType)
.orderedStream()
.collect(Can.toCan());
return allMatchingBeans;
@@ -95,21 +94,21 @@ final class _IocContainer_Spring implements _IocContainer {
final @NonNull Class<T> requiredType,
final @Nullable Annotation[] qualifiers) {
- val qualifiersRequired = filterQualifiers(qualifiers);
+ var qualifiersRequired = filterQualifiers(qualifiers);
if(_NullSafe.isEmpty(qualifiersRequired)) {
- val allMatchingBeans = springContext.getBeanProvider(requiredType)
+ var allMatchingBeans = springContext.getBeanProvider(requiredType)
.orderedStream()
.collect(Can.toCan());
return allMatchingBeans;
}
- val allMatchingBeans = springContext.getBeanProvider(requiredType)
+ var allMatchingBeans = springContext.getBeanProvider(requiredType)
.orderedStream()
.filter(t->{
- val qualifiersPresent = _Sets.of(t.getClass().getAnnotations());
+ var qualifiersPresent = _Sets.of(t.getClass().getAnnotations());
return qualifiersPresent.containsAll(qualifiersRequired);
})
.collect(Can.toCan());
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/os/_OsUtil.java b/commons/src/main/java/org/apache/causeway/commons/internal/os/_OsUtil.java
index bcd124709a..609eeb2db4 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/os/_OsUtil.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/os/_OsUtil.java
@@ -33,7 +33,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import org.apache.causeway.commons.io.TextUtils;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -60,7 +59,7 @@ public class _OsUtil {
public boolean isLinux() { return this==LINUX; }
public boolean isMacOs() { return this==MAC_OS; }
public static OS current() {
- val osName = System.getProperty("os.name").toLowerCase();
+ var osName = System.getProperty("os.name").toLowerCase();
if (osName.startsWith("windows")) {
return OS.WINDOWS;
}
@@ -100,7 +99,7 @@ public class _OsUtil {
}
final long newPid = ProcessHandle.current().pid();
- try(val fw = new FileWriter(pidFile, StandardCharsets.UTF_8)) {
+ try(var fw = new FileWriter(pidFile, StandardCharsets.UTF_8)) {
fw.write("" + newPid);
}
}
@@ -121,12 +120,12 @@ public class _OsUtil {
@SneakyThrows
public void terminateProcessByPid(final @Nullable String pid) {
- val pidTrimmed = _Strings.blankToNullOrTrim(pid);
+ var pidTrimmed = _Strings.blankToNullOrTrim(pid);
if(pidTrimmed==null) {
return; // do nothing
}
- val rt = Runtime.getRuntime();
- val os = OS.current();
+ var rt = Runtime.getRuntime();
+ var os = OS.current();
final String[] cmd;
switch(os) {
case WINDOWS:
@@ -155,7 +154,7 @@ public class _OsUtil {
boolean valid = false;
for (NetworkInterface netint : Collections.list(NetworkInterface.getNetworkInterfaces())) {
- val hwAddr = netint.getHardwareAddress();
+ var hwAddr = netint.getHardwareAddress();
if(_NullSafe.size(hwAddr)<6) {
continue;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Doubles.java b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Doubles.java
index c36e5afd36..f618bb3a0f 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Doubles.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Doubles.java
@@ -23,7 +23,6 @@ import java.util.Optional;
import java.util.OptionalDouble;
import lombok.NonNull;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -59,7 +58,7 @@ public class _Doubles {
* if {@code decimal} cannot be approximated by {@link Double}.
*/
public double convertToDouble(final @NonNull BigDecimal decimal) {
- val doubleValue = decimal.doubleValue();
+ var doubleValue = decimal.doubleValue();
// overflow detection
if(!Double.isFinite(doubleValue)) {
throw new ArithmeticException("non finite BigDecimal to double conversion");
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Floats.java b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Floats.java
index a5ae3e1e79..1143c49e51 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Floats.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Floats.java
@@ -22,7 +22,6 @@ import java.math.BigDecimal;
import java.util.Optional;
import lombok.NonNull;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -56,7 +55,7 @@ public class _Floats {
* if {@code decimal} cannot not be approximated by {@link Double}.
*/
public float convertToFloat(final @NonNull BigDecimal decimal) {
- val floatValue = decimal.floatValue();
+ var floatValue = decimal.floatValue();
// overflow detection
if(!Float.isFinite(floatValue)) {
throw new ArithmeticException("non finite BigDecimal to float conversion");
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Ints.java b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Ints.java
index f111a26a54..8b5781f60d 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Ints.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Ints.java
@@ -35,7 +35,6 @@ import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Value;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -91,13 +90,13 @@ public class _Ints {
private final boolean empty;
public boolean contains(final int value) {
if(empty) return false;
- val isBelowLower = lowerBound.isInclusive()
+ var isBelowLower = lowerBound.isInclusive()
? value < lowerBound.getValue()
: value <= lowerBound.getValue();
if(isBelowLower) {
return false;
}
- val isAboveUpper = upperBound.isInclusive()
+ var isAboveUpper = upperBound.isInclusive()
? value > upperBound.getValue()
: value >= upperBound.getValue();
if(isAboveUpper) {
@@ -322,7 +321,7 @@ public class _Ints {
}
result -= digit;
}
- val value = negative ? result : -result;
+ var value = negative ? result : -result;
return value;
} else {
onFailure.accept(s);
@@ -335,7 +334,7 @@ public class _Ints {
public static int[] flatten(final @NonNull int[][] nested) {
final int n = nested.length;
final int stride = nested[0].length;
- val flattened = new int[n*stride];
+ var flattened = new int[n*stride];
for(int i=0; i<n; ++i) {
System.arraycopy(nested[i], 0, flattened, i*stride, stride);
}
@@ -347,7 +346,7 @@ public class _Ints {
public static int[][] partition(final @NonNull int[] flattened, final int stride) {
final int n = flattened.length/stride;
_Assert.assertEquals(flattened.length, n*stride, ()->"flattened.length must be divisible by stride");
- val nested = new int[n][stride];
+ var nested = new int[n][stride];
for(int i=0; i<n; ++i) {
System.arraycopy(flattened, i*stride, nested[i], 0, stride);
}
@@ -367,12 +366,12 @@ public class _Ints {
final @NonNull IntFunction<String> cellFormatter) {
final int m = array.length;
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
for(int j=0; j<m; ++j) {
final int cellValue = array[j];
- val cellStringFull = cellFormatter.apply(cellValue);
- val cellStringTrimmed = _Strings.ellipsifyAtEnd(cellStringFull, columnWidth, "..");
+ var cellStringFull = cellFormatter.apply(cellValue);
+ var cellStringTrimmed = _Strings.ellipsifyAtEnd(cellStringFull, columnWidth, "..");
// right align, at column end marker
final int spacesCount = columnWidth - cellStringTrimmed.length();
@@ -398,7 +397,7 @@ public class _Ints {
final @NonNull IntFunction<String> cellFormatter) {
final int n = nested.length;
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
for(int i=0; i<n; ++i) {
sb.append(rowForm(nested[i], columnWidth, cellFormatter));
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Longs.java b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Longs.java
index 93794bb49d..602354e3ea 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Longs.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/primitives/_Longs.java
@@ -29,7 +29,6 @@ import org.apache.causeway.commons.internal.primitives._Ints.BiIntFunction;
import lombok.NonNull;
import lombok.Value;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -62,13 +61,13 @@ public class _Longs {
@NonNull Bound lowerBound;
@NonNull Bound upperBound;
public boolean contains(final long value) {
- val isBelowLower = lowerBound.isInclusive()
+ var isBelowLower = lowerBound.isInclusive()
? value < lowerBound.getValue()
: value <= lowerBound.getValue();
if(isBelowLower) {
return false;
}
- val isAboveUpper = upperBound.isInclusive()
+ var isAboveUpper = upperBound.isInclusive()
? value > upperBound.getValue()
: value >= upperBound.getValue();
if(isAboveUpper) {
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java
index 6fa8d7fb55..f78285dd3a 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations.java
@@ -32,7 +32,6 @@ import org.springframework.core.annotation.MergedAnnotations.SearchStrategy;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -65,7 +64,7 @@ public final class _Annotations {
final AnnotatedElement annotatedElement,
final Class<A> annotationType) {
- val collected = collect(annotatedElement, SearchStrategy.TYPE_HIERARCHY);
+ var collected = collect(annotatedElement, SearchStrategy.TYPE_HIERARCHY);
if(collected.isPresent(annotationType)) {
return true;
@@ -97,10 +96,10 @@ public final class _Annotations {
final AnnotatedElement annotatedElement,
final Class<A> annotationType) {
- val collected = collect(annotatedElement, SearchStrategy.TYPE_HIERARCHY);
+ var collected = collect(annotatedElement, SearchStrategy.TYPE_HIERARCHY);
// also handle annotated fields, getter methods might be associated with
- val associated =
+ var associated =
annotatedFieldForAnnotatedElement(annotatedElement, annotationType)
.map(fieldForGetter->collect(fieldForGetter, SearchStrategy.TYPE_HIERARCHY));
@@ -124,10 +123,10 @@ public final class _Annotations {
final Method annotatedMethod,
final Class<A> annotationType) {
- val collected = collect(annotatedMethod, SearchStrategy.TYPE_HIERARCHY);
+ var collected = collect(annotatedMethod, SearchStrategy.TYPE_HIERARCHY);
// also handle containing class
- val associatedClass = collect(annotatedMethod.getDeclaringClass(), SearchStrategy.TYPE_HIERARCHY);
+ var associatedClass = collect(annotatedMethod.getDeclaringClass(), SearchStrategy.TYPE_HIERARCHY);
return _Annotations_SynthesizedMergedAnnotationInvocationHandler
.createProxy(collected, Optional.of(associatedClass), annotationType);
@@ -153,10 +152,10 @@ public final class _Annotations {
final AnnotatedElement annotatedElement,
final Class<A> annotationType) {
- val collected = collect(annotatedElement, SearchStrategy.DIRECT);
+ var collected = collect(annotatedElement, SearchStrategy.DIRECT);
// also handle annotated fields, getter methods might be associated with
- val associated =
+ var associated =
annotatedFieldForAnnotatedElement(annotatedElement, annotationType)
.map(fieldForGetter->collect(fieldForGetter, SearchStrategy.DIRECT));
@@ -179,10 +178,10 @@ public final class _Annotations {
final Class<A> annotationType,
final SearchStrategy searchStrategy) {
- val collected = collect(annotatedElement, searchStrategy);
+ var collected = collect(annotatedElement, searchStrategy);
// also handle annotated fields, getter methods might be associated with
- val associated =
+ var associated =
annotatedFieldForAnnotatedElement(annotatedElement, annotationType)
.map(fieldForGetter->collect(fieldForGetter, searchStrategy));
@@ -196,16 +195,16 @@ public final class _Annotations {
private static MergedAnnotations collect(
final AnnotatedElement annotatedElement,
final SearchStrategy searchStrategy) {
- val collected = MergedAnnotations.from(annotatedElement, searchStrategy);
+ var collected = MergedAnnotations.from(annotatedElement, searchStrategy);
return collected;
}
private static boolean isAnnotationAllowedOnField(final Class<? extends Annotation> annotationType) {
- val target = annotationType.getAnnotation(Target.class);
+ var target = annotationType.getAnnotation(Target.class);
if(target==null) {
return false;
}
- for(val elementType : target.value()) {
+ for(var elementType : target.value()) {
if(elementType == ElementType.FIELD) {
return true;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_AttributeMethods.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_AttributeMethods.java
index a5014b92f4..8474268105 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_AttributeMethods.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_AttributeMethods.java
@@ -130,7 +130,7 @@ final class _Annotations_AttributeMethods {
/**
* Check if values from the given annotation can be safely accessed without causing
* any {@link TypeNotPresentException TypeNotPresentExceptions}. In particular,
- * this method is designed to cover Google App Engine's late arrival of such
+ * this method is designed to cover Google App Engine's late arrivar of such
* exceptions for {@code Class} values (instead of the more typical early
* {@code Class.getAnnotations() failure}.
* @param annotation the annotation to validate
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_SynthesizedMergedAnnotationInvocationHandler.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_SynthesizedMergedAnnotationInvocationHandler.java
index 6b4de058b0..4a458dbb1c 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_SynthesizedMergedAnnotationInvocationHandler.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Annotations_SynthesizedMergedAnnotationInvocationHandler.java
@@ -42,7 +42,6 @@ import org.springframework.util.ReflectionUtils;
import org.apache.causeway.commons.internal.base._NullSafe;
import lombok.NonNull;
-import lombok.val;
/**
* {@link InvocationHandler} for an {@link Annotation} that Spring has
@@ -198,10 +197,10 @@ implements InvocationHandler {
String name = method.getName();
Class<?> type = ClassUtils.resolvePrimitiveIfNecessary(method.getReturnType());
- val defaultValue = method.getDefaultValue();
+ var defaultValue = method.getDefaultValue();
// for all discovered annotations of this.type determine the effective (attribute) value
- val attributeValue = streamAnnotations()
+ var attributeValue = streamAnnotations()
.map(mergedAnnotation->(Object)mergedAnnotation.getValue(name, type).orElse(null))
.filter(_NullSafe::isPresent)
.filter(value->!value.equals(defaultValue))
@@ -217,9 +216,9 @@ implements InvocationHandler {
final @NonNull Optional<MergedAnnotations> additional,
final @NonNull Class<A> annotationType) {
- val hasCollected = collected
+ var hasCollected = collected
.isPresent(annotationType);
- val hasAdditional = additional
+ var hasAdditional = additional
.map(mergedAnnotations->mergedAnnotations.isPresent(annotationType))
.orElse(false);
@@ -229,17 +228,17 @@ implements InvocationHandler {
return Optional.empty();
}
- val invocationHandler = hasCollected
+ var invocationHandler = hasCollected
? new _Annotations_SynthesizedMergedAnnotationInvocationHandler<>(
collected, additional.orElse(null), annotationType)
: new _Annotations_SynthesizedMergedAnnotationInvocationHandler<>(
additional.get(), null, annotationType);
- val classLoader = annotationType.getClassLoader();
- val interfaces = isVisible(classLoader, SynthesizedAnnotation.class)
+ var classLoader = annotationType.getClassLoader();
+ var interfaces = isVisible(classLoader, SynthesizedAnnotation.class)
? new Class<?>[] {annotationType, SynthesizedAnnotation.class}
: new Class<?>[] {annotationType};
- val proxy = (A) Proxy.newProxyInstance(classLoader, interfaces, invocationHandler);
+ var proxy = (A) Proxy.newProxyInstance(classLoader, interfaces, invocationHandler);
return Optional.of(proxy);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_ClassCache.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_ClassCache.java
index 3611183610..a3f9d54fce 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_ClassCache.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_ClassCache.java
@@ -56,7 +56,6 @@ import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -169,7 +168,7 @@ public final class _ClassCache implements AutoCloseable {
@SneakyThrows
public ResolvedMethod findMethodUniquelyByNameOrFail(final Class<?> type, final String methodName) {
- val matchingMethods = streamResolvedMethods(type)
+ var matchingMethods = streamResolvedMethods(type)
.filter(method->method.name().equals(methodName))
.collect(Can.toCan());
return matchingMethods.isCardinalityMultiple()
@@ -189,7 +188,7 @@ public final class _ClassCache implements AutoCloseable {
// -- FIELD vs GETTER
public Optional<ResolvedMethod> getterForField(final Class<?> type, final Field field) {
- val capitalizedFieldName = _Strings.capitalize(field.getName());
+ var capitalizedFieldName = _Strings.capitalize(field.getName());
return Stream.of("get", "is")
.map(prefix->prefix + capitalizedFieldName)
.map(methodName->lookupResolvedMethod(type, methodName, _Constants.emptyClasses).orElse(null))
@@ -217,7 +216,7 @@ public final class _ClassCache implements AutoCloseable {
final String attributeName,
final Predicate<ResolvedMethod> filter) {
- val classModel = classModel(type);
+ var classModel = classModel(type);
synchronized(classModel.declaredMethodsByAttribute) {
return classModel.declaredMethodsByAttribute
@@ -235,7 +234,7 @@ public final class _ClassCache implements AutoCloseable {
final Class<?> type,
final String attributeName,
final String value) {
- val classModel = classModel(type);
+ var classModel = classModel(type);
classModel.attributeMap.put(attributeName, value);
return this;
}
@@ -243,7 +242,7 @@ public final class _ClassCache implements AutoCloseable {
public Optional<String> lookupAttribute(
final Class<?> type,
final String attributeName) {
- val classModel = classModel(type);
+ var classModel = classModel(type);
return Optional.ofNullable(classModel.attributeMap.get(attributeName));
}
@@ -340,7 +339,7 @@ public final class _ClassCache implements AutoCloseable {
final Class<?> type = reloadType(_type);
//TODO[CAUSEWAY-3556] optimization candidate (needs inspectedTypes to be a ConcurrentHashMap)
-// val declaredMethods = _Reflect.streamTypeHierarchy(type, InterfacePolicy.INCLUDE)
+// var declaredMethods = _Reflect.streamTypeHierarchy(type, InterfacePolicy.INCLUDE)
// .filter(cls->cls.equals(Object.class))
// .flatMap(cls->{
// return cls.equals(type)
@@ -350,16 +349,16 @@ public final class _ClassCache implements AutoCloseable {
// })
// .collect(Can.toCan());
- val model = new ClassModel(
+ var model = new ClassModel(
Can.ofArray(type.getDeclaredFields()),
_Annotations.isPresent(type, XmlRootElement.class),
_Annotations.isPresent(type, Named.class));
// process public constructors
- val publicConstr = type.getConstructors();
- for(val constr : publicConstr) {
- val key = ConstructorKey.of(type, constr);
- val resolvedConstr = _GenericResolver.resolveConstructor(constr, type);
+ var publicConstr = type.getConstructors();
+ for(var constr : publicConstr) {
+ var key = ConstructorKey.of(type, constr);
+ var resolvedConstr = _GenericResolver.resolveConstructor(constr, type);
// collect public constructors
model.publicConstructorsByKey.put(key, resolvedConstr);
// collect public constructors with inject semantics
@@ -374,8 +373,8 @@ public final class _ClassCache implements AutoCloseable {
.map(method->_GenericResolver.resolveMethod(method, type).orElse(null))
.filter(_NullSafe::isPresent)
.forEach(resolved->{
- val key = MethodKey.of(type, resolved.method());
- val methodToKeep =
+ var key = MethodKey.of(type, resolved.method());
+ var methodToKeep =
putIntoMapHonoringOverridingRelation(model.resolvedMethodsByKey, key, resolved);
// collect post-construct methods
if(isPostConstruct(methodToKeep.method())) {
@@ -389,7 +388,7 @@ public final class _ClassCache implements AutoCloseable {
.map(method->_GenericResolver.resolveMethod(method, type).orElse(null))
.filter(_NullSafe::isPresent)
.forEach(resolved->{
- val key = MethodKey.of(type, resolved.method());
+ var key = MethodKey.of(type, resolved.method());
putIntoMapHonoringOverridingRelation(model.publicMethodsByKey, key, resolved);
});
@@ -402,15 +401,15 @@ public final class _ClassCache implements AutoCloseable {
*/
private static ResolvedMethod putIntoMapHonoringOverridingRelation(
final Map<MethodKey, ResolvedMethod> map, final MethodKey key, final ResolvedMethod method) {
- val methodWithSameKey = map.get(key); // in case the map is already populated
- val methodToKeep = methodWithSameKey==null
+ var methodWithSameKey = map.get(key); // in case the map is already populated
+ var methodToKeep = methodWithSameKey==null
? method
/* key-clash originating from one method overriding the other
* we need to keep the most specific one */
: methodWithSameKey.mostSpecific(method);
map.put(key, methodToKeep);
- val weaklySame = map.values().stream()
+ var weaklySame = map.values().stream()
.filter(m->ResolvedMethod.methodsWeaklySame(methodToKeep, m))
.collect(Can.toCan());
@@ -418,9 +417,9 @@ public final class _ClassCache implements AutoCloseable {
map.values().removeIf(weaklySame::contains);
- val winner = weaklySame.reduce(ResolvedMethod::mostSpecific)
+ var winner = weaklySame.reduce(ResolvedMethod::mostSpecific)
.getSingletonOrFail();
- val winnerKey = MethodKey.of(winner.implementationClass(), winner.method());
+ var winnerKey = MethodKey.of(winner.implementationClass(), winner.method());
map.put(winnerKey, winner);
return winner;
}
@@ -454,10 +453,10 @@ public final class _ClassCache implements AutoCloseable {
final Class<?> type,
final Class<?>[] paramTypes) {
- val model = classModel(type);
- val key = ConstructorKey.of(type, _Arrays.emptyToNull(paramTypes));
+ var model = classModel(type);
+ var key = ConstructorKey.of(type, _Arrays.emptyToNull(paramTypes));
- val publicConstructor = model.publicConstructorsByKey.get(key);
+ var publicConstructor = model.publicConstructorsByKey.get(key);
return publicConstructor;
}
@@ -470,9 +469,9 @@ public final class _ClassCache implements AutoCloseable {
// we need to lookup by name then find first (weak) match
- val model = classModel(type);
+ var model = classModel(type);
- val publicMethod = model.publicMethodsByKey.values().stream()
+ var publicMethod = model.publicMethodsByKey.values().stream()
.filter(m->m.name().equals(name))
.filter(m->_Reflect.methodSignatureAssignableTo(m.paramTypes(), requiredParamTypes))
.findFirst()
@@ -482,7 +481,7 @@ public final class _ClassCache implements AutoCloseable {
}
if(includeDeclaredMethods) {
- val resolvedMethod = model.resolvedMethodsByKey.values().stream()
+ var resolvedMethod = model.resolvedMethodsByKey.values().stream()
.filter(m->m.name().equals(name))
.filter(m->_Reflect.methodSignatureAssignableTo(m.paramTypes(), requiredParamTypes))
.findFirst()
@@ -498,11 +497,11 @@ public final class _ClassCache implements AutoCloseable {
if(ReflectionUtils.isObjectMethod(getterCandidate)) {
return null;
}
- val fieldNameCandidate = fieldNameForGetter(getterCandidate);
+ var fieldNameCandidate = fieldNameForGetter(getterCandidate);
if(fieldNameCandidate==null) {
return null;
}
- val declaringClass = getterCandidate.getDeclaringClass();
+ var declaringClass = getterCandidate.getDeclaringClass();
return ReflectionUtils.findField(declaringClass, fieldNameCandidate);
}
@@ -513,7 +512,7 @@ public final class _ClassCache implements AutoCloseable {
if(getter.getReturnType()==void.class) {
return null;
}
- val methodName = getter.getName();
+ var methodName = getter.getName();
String fieldName = null;
if(methodName.startsWith("is") && methodName.length() > 2) {
fieldName = methodName.substring(2);
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_GenericResolver.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_GenericResolver.java
index e2c158e21d..711a4f0440 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_GenericResolver.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_GenericResolver.java
@@ -45,7 +45,6 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.Accessors;
import lombok.experimental.UtilityClass;
@@ -189,8 +188,8 @@ public class _GenericResolver {
if(c!=0) {
return c;
}
- val paramsA = a.paramTypes();
- val paramsB = b.paramTypes();
+ var paramsA = a.paramTypes();
+ var paramsB = b.paramTypes();
for(int i=0; i<a.paramCount(); ++i) {
c = _Reflect.typesCompare(paramsA[i], paramsB[i]);
if(c!=0) {
@@ -246,8 +245,8 @@ public class _GenericResolver {
public ResolvedType forPluralType(
final @NonNull Class<?> pluralType,
final @NonNull CollectionSemantics collectionSemantics) {
- val resolvablePluralType = ResolvableType.forClass(pluralType);
- val genericTypeArg = resolvablePluralType.isArray()
+ var resolvablePluralType = ResolvableType.forClass(pluralType);
+ var genericTypeArg = resolvablePluralType.isArray()
? resolvablePluralType.getComponentType()
: resolvablePluralType.getGeneric(0);
return ResolvedType.plural(
@@ -260,7 +259,7 @@ public class _GenericResolver {
* Resolves a constructor's parameter type.
*/
public ResolvedType forConstructorParameter(final ResolvedConstructor resolvedConstructor, final int paramIndex) {
- val paramType = resolvedConstructor.paramType(paramIndex);
+ var paramType = resolvedConstructor.paramType(paramIndex);
return CollectionSemantics.valueOf(paramType)
.map(collectionSemantics->
ResolvedType.plural(
@@ -275,7 +274,7 @@ public class _GenericResolver {
* Resolves a method's return type.
*/
public ResolvedType forMethodReturn(final ResolvedMethod resolvedMethod) {
- val methodReturn = resolvedMethod.returnType();
+ var methodReturn = resolvedMethod.returnType();
return CollectionSemantics.valueOf(methodReturn)
.map(collectionSemantics->
ResolvedType.plural(
@@ -290,7 +289,7 @@ public class _GenericResolver {
* Resolves a method's parameter type.
*/
public ResolvedType forMethodParameter(final ResolvedMethod resolvedMethod, final int paramIndex) {
- val paramType = resolvedMethod.paramType(paramIndex);
+ var paramType = resolvedMethod.paramType(paramIndex);
return CollectionSemantics.valueOf(paramType)
.map(collectionSemantics->
ResolvedType.plural(
@@ -386,8 +385,8 @@ public class _GenericResolver {
}
// private Try<SimpleResolvedMethod> adopt(final @NonNull ClassLoader classLoader) {
// return Try.call(()->{
-// val ownerReloaded = Class.forName(implementationClass.getName(), true, classLoader);
-// val methodReloaded = ownerReloaded.getMethod(method.getName(), method.getParameterTypes());
+// var ownerReloaded = Class.forName(implementationClass.getName(), true, classLoader);
+// var methodReloaded = ownerReloaded.getMethod(method.getName(), method.getParameterTypes());
// return new SimpleResolvedMethod(methodReloaded, ownerReloaded);
// });
// }
@@ -427,8 +426,8 @@ public class _GenericResolver {
// -- HELPER
// private Try<SimpleResolvedConstructor> adopt(final @NonNull ClassLoader classLoader) {
// return Try.call(()->{
-// val ownerReloaded = Class.forName(implementationClass.getName(), true, classLoader);
-// val methodReloaded = ownerReloaded.getConstructor(constructor.getParameterTypes());
+// var ownerReloaded = Class.forName(implementationClass.getName(), true, classLoader);
+// var methodReloaded = ownerReloaded.getConstructor(constructor.getParameterTypes());
// return new SimpleResolvedConstructor(methodReloaded, ownerReloaded);
// });
// }
@@ -465,9 +464,9 @@ public class _GenericResolver {
if(a.equals(b)) return b; // an arbitrary pick
// if declared types are different chose the mostSpecific type
- val implType = _Reflect.mostSpecificType(a.implementationClass(), b.implementationClass());
+ var implType = _Reflect.mostSpecificType(a.implementationClass(), b.implementationClass());
- val m = BridgeMethodResolver.findBridgedMethod(
+ var m = BridgeMethodResolver.findBridgedMethod(
ClassUtils.getMostSpecificMethod(a.method(), implType));
if(m.isBridge()) {
throw _Exceptions.unexpectedCodeReach();
@@ -487,7 +486,7 @@ public class _GenericResolver {
}
private ResolvableType genericTypeArg(final ResolvableType pluralType){
- val genericTypeArg = pluralType.isArray()
+ var genericTypeArg = pluralType.isArray()
? pluralType.getComponentType()
: pluralType.getGeneric(0);
return genericTypeArg;
@@ -506,9 +505,9 @@ public class _GenericResolver {
final @NonNull String methodName,
final Class<?>... parameterTypes) {
- val candidate = _ClassCache.getInstance().findMethodUniquelyByNameOrFail(implementationClass, methodName);
- val paramTypesFound = Can.ofArray(candidate.paramTypes());
- val paramTypesRequested = Can.ofArray(parameterTypes);
+ var candidate = _ClassCache.getInstance().findMethodUniquelyByNameOrFail(implementationClass, methodName);
+ var paramTypesFound = Can.ofArray(candidate.paramTypes());
+ var paramTypesRequested = Can.ofArray(parameterTypes);
_Assert.assertEquals(paramTypesFound, paramTypesRequested);
return candidate;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Generics.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Generics.java
index e12fd926a1..496a43defe 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Generics.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Generics.java
@@ -33,7 +33,6 @@ import org.apache.causeway.commons.collections.Can;
import org.apache.causeway.commons.internal.base._NullSafe;
import lombok.NonNull;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -160,7 +159,7 @@ public final class _Generics {
return Stream.of((Class<?>) type);
}
if (type instanceof WildcardType) {
- val wildcardType = (WildcardType) type;
+ var wildcardType = (WildcardType) type;
return Stream.concat(
Stream.of(wildcardType.getLowerBounds()),
Stream.of(wildcardType.getUpperBounds()))
@@ -172,8 +171,8 @@ public final class _Generics {
// try to match up with the actual type argument of the owner's generic superclass.
final Type genericSuperclass = owner.getGenericSuperclass();
if(genericSuperclass instanceof ParameterizedType) {
- val parameterizedTypeOfSuperclass = (ParameterizedType)genericSuperclass;
- val genericDeclaration = ((TypeVariable<?>) type).getGenericDeclaration();
+ var parameterizedTypeOfSuperclass = (ParameterizedType)genericSuperclass;
+ var genericDeclaration = ((TypeVariable<?>) type).getGenericDeclaration();
if(parameterizedTypeOfSuperclass.getRawType() == genericDeclaration) {
return Stream.of(parameterizedTypeOfSuperclass.getActualTypeArguments())
.flatMap(actualType->streamClassesOfType(owner, actualType)); // recursive call
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_MethodFacades.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_MethodFacades.java
index 048fdcc1f5..ab5ba9615c 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_MethodFacades.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_MethodFacades.java
@@ -36,7 +36,6 @@ import org.apache.causeway.commons.internal.reflection._GenericResolver.Resolved
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -104,10 +103,10 @@ public class _MethodFacades {
if(paramCount==0) {
return _Constants.emptyObjects;
}
- val parameterTypes = executable.getParameterTypes();
- val adaptedExecutionParameters = new Object[paramCount];
+ var parameterTypes = executable.getParameterTypes();
+ var adaptedExecutionParameters = new Object[paramCount];
for(int i=0; i<paramCount; ++i) {
- val origParam = _Arrays.get(executionParameters, i).orElse(null);
+ var origParam = _Arrays.get(executionParameters, i).orElse(null);
adaptedExecutionParameters[i] = convert(parameterTypes[i], origParam);
}
return adaptedExecutionParameters;
@@ -165,7 +164,7 @@ public class _MethodFacades {
}
default ResolvedType resolveParameter(final int paramIndex) {
- val executable = this.asExecutable();
+ var executable = this.asExecutable();
if(executable instanceof Method) {
return _GenericResolver.forMethodParameter(this.asMethodForIntrospection(), paramIndex);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Reflect.java b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Reflect.java
index 4190f02035..439b5dfc76 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Reflect.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/reflection/_Reflect.java
@@ -55,7 +55,6 @@ import org.apache.causeway.commons.internal.functions._Predicates;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -166,8 +165,8 @@ public final class _Reflect {
if(c!=0) {
return c;
}
- val paramsA = a.getParameters();
- val paramsB = b.getParameters();
+ var paramsA = a.getParameters();
+ var paramsB = b.getParameters();
for(int i=0; i<a.getParameterCount(); ++i) {
c = typesCompare(paramsA[i].getType(), paramsB[i].getType());
if(c!=0) {
@@ -690,7 +689,7 @@ public final class _Reflect {
// -- SPECIAL PREDICATES
public boolean isNonFinalObjectMethod(final @NonNull Method method) {
- for(val m : _Constants.nonFinalObjectMethods) {
+ for(var m : _Constants.nonFinalObjectMethods) {
if(methodsSame(m, method)) return true;
}
return false;
@@ -708,7 +707,7 @@ public final class _Reflect {
}
public boolean isJavaApiClass(final @NonNull Class<?> cls) {
- val className = cls.getName();
+ var className = cls.getName();
return className.startsWith("java.")
|| className.startsWith("sun.");
}
@@ -731,7 +730,7 @@ public final class _Reflect {
// }
//
// private Predicate<Method> methodMatcherOnNameAndSignature(final @NonNull Method ref) {
-// val refSignature = ref.getParameterTypes();
+// var refSignature = ref.getParameterTypes();
// return other->
// (!ref.getName().equals(other.getName()))
// ? false
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Resources.java b/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Resources.java
index 543ab862a0..770681d6b4 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Resources.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Resources.java
@@ -36,7 +36,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -82,7 +81,7 @@ public final class _Resources {
final @NonNull Class<?> contextClass,
final @NonNull String resourceName) {
- val absoluteResourceName = resolveName(contextClass, resourceName);
+ var absoluteResourceName = resolveName(contextClass, resourceName);
return Optional
.ofNullable(contextClass.getResourceAsStream(absoluteResourceName))
@@ -104,7 +103,7 @@ public final class _Resources {
final @NonNull String resourceName,
final @NonNull Charset charset) {
- val inputStream = load(contextClass, resourceName);
+ var inputStream = load(contextClass, resourceName);
return _Strings.ofBytes(_Bytes.of(inputStream), charset);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Serializables.java b/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Serializables.java
index a4a6558809..4bec59c56e 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Serializables.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/resources/_Serializables.java
@@ -30,7 +30,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
/**
* <h1>- internal use only -</h1>
@@ -48,8 +47,8 @@ public class _Serializables {
@SneakyThrows
public static byte[] write(
final @NonNull Serializable object) {
- val bos = new ByteArrayOutputStream(16*4096); // 16k initial buffer size
- try(val oos = new ObjectOutputStream(bos)) {
+ var bos = new ByteArrayOutputStream(16*4096); // 16k initial buffer size
+ try(var oos = new ObjectOutputStream(bos)) {
oos.writeObject(object);
oos.flush();
}
@@ -61,8 +60,8 @@ public class _Serializables {
public static <T extends Serializable> T read(
final @NonNull Class<T> requiredClass,
final @NonNull InputStream content) {
- try(val ois = new ObjectInputStream(content)){
- val pojo = ois.readObject();
+ try(var ois = new ObjectInputStream(content)){
+ var pojo = ois.readObject();
if(!(requiredClass.isAssignableFrom(pojo.getClass()))) {
throw _Exceptions.unrecoverable(
"de-serializion of input stream did not yield an object of required type %s",
@@ -76,7 +75,7 @@ public class _Serializables {
public static <T extends Serializable> T read(
final @NonNull Class<T> requiredClass,
final @NonNull byte[] input) {
- try(val bis = new ByteArrayInputStream(input)) {
+ try(var bis = new ByteArrayInputStream(input)) {
return read(requiredClass, bis);
}
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/testing/_SerializationTester.java b/commons/src/main/java/org/apache/causeway/commons/internal/testing/_SerializationTester.java
index f0a0ba3c7c..6312d7ee41 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/testing/_SerializationTester.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/testing/_SerializationTester.java
@@ -25,7 +25,6 @@ import org.apache.causeway.commons.internal.base._Casts;
import org.apache.causeway.commons.internal.resources._Serializables;
import lombok.SneakyThrows;
-import lombok.val;
/**
* in-memory serialization round-tripping
@@ -36,7 +35,7 @@ public class _SerializationTester {
@SneakyThrows
public static <T extends Serializable> T roundtrip(final T object) {
- val bytes = _Serializables.write(object);
+ var bytes = _Serializables.write(object);
return _Casts.uncheckedCast(
_Serializables.read(object.getClass(), bytes));
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/DataPeer.java b/commons/src/main/java/org/apache/causeway/commons/io/DataPeer.java
index 3d8827ed8a..b916d0526f 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/DataPeer.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/DataPeer.java
@@ -28,7 +28,6 @@ import org.apache.causeway.commons.functional.Try;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
-import lombok.val;
/**
* General purpose byte data peer that acts as source and sink at the same time.
@@ -43,12 +42,12 @@ public interface DataPeer extends DataSink, DataSource {
static DataPeer inMemory(final int initialBufferSize) {
- val byteArrayHolder = new ArrayList<byte[]>(1);
+ var byteArrayHolder = new ArrayList<byte[]>(1);
return new DataPeer() {
@Override
public <T> Try<T> tryReadAll(@NonNull final Function<InputStream, Try<T>> consumingMapper) {
- val in = DataSource.ofBytes(bytes());
+ var in = DataSource.ofBytes(bytes());
return in.tryReadAll(consumingMapper);
}
@@ -57,7 +56,7 @@ public interface DataPeer extends DataSink, DataSource {
if(!byteArrayHolder.isEmpty()) {
throw _Exceptions.illegalState("Cannot writeAll to an in-memory DataPeer, that was already written to.");
}
- val out = DataSink.ofByteArrayConsumer(byteArrayHolder::add, initialBufferSize);
+ var out = DataSink.ofByteArrayConsumer(byteArrayHolder::add, initialBufferSize);
out.writeAll(outputStreamConsumer);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/DataSource.java b/commons/src/main/java/org/apache/causeway/commons/io/DataSource.java
index ada18e7084..f8f0b3e052 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/DataSource.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/DataSource.java
@@ -47,7 +47,6 @@ import org.apache.causeway.commons.io.HashUtils.HashAlgorithm;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
/**
* General purpose readable byte data source.
@@ -169,7 +168,7 @@ public interface DataSource {
* (eg the decode or encode the originating input stream)
*/
default DataSource map(final @NonNull ThrowingFunction<InputStream, InputStream> inputStreamMapper) {
- val self = this;
+ var self = this;
return new DataSource() {
@Override public <T> Try<T> tryReadAll(final @NonNull Function<InputStream, Try<T>> consumingMapper) {
return self.tryReadAll(is->consumingMapper.apply(inputStreamMapper.apply(is)));
@@ -190,7 +189,7 @@ public interface DataSource {
default Try<Void> tryReadAndWrite(final @NonNull DataSink dataSink, final int bufferSize) {
return tryReadAndAccept(inputStream->{
dataSink.writeAll(os->{
- val buffer = new byte[bufferSize]; int n;
+ var buffer = new byte[bufferSize]; int n;
while((n = inputStream.read(buffer)) > -1) {
os.write(buffer, 0, n);
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/DtoMapper.java b/commons/src/main/java/org/apache/causeway/commons/io/DtoMapper.java
index c341a92cd1..631c8cb489 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/DtoMapper.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/DtoMapper.java
@@ -26,7 +26,6 @@ import org.springframework.lang.Nullable;
import org.apache.causeway.commons.functional.Try;
import lombok.NonNull;
-import lombok.val;
public interface DtoMapper<T> {
@@ -42,7 +41,7 @@ public interface DtoMapper<T> {
@Nullable
default String toString(final @Nullable T dto) {
if(dto==null) return null;
- val stringHolder = new ArrayList<String>(1);
+ var stringHolder = new ArrayList<String>(1);
write(dto, DataSink.ofStringUtf8Consumer(stringHolder::add));
return stringHolder.get(0);
}
@@ -55,7 +54,7 @@ public interface DtoMapper<T> {
default T clone(final @Nullable T dto) {
if(dto==null) return dto;
- val bytesHolder = new ArrayList<byte[]>(1);
+ var bytesHolder = new ArrayList<byte[]>(1);
write(dto, DataSink.ofByteArrayConsumer(bytesHolder::add));
return read(DataSource.ofBytes(bytesHolder.get(0)));
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java b/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java
index 0eadb5a2c4..247b8eebe1 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/FileUtils.java
@@ -49,7 +49,6 @@ import org.apache.causeway.commons.internal.exceptions._Exceptions;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -71,7 +70,7 @@ public class FileUtils {
*/
public <T> Try<T> tryReadAndApply(final @Nullable File file, final @NonNull ThrowingFunction<InputStream, T> inputStreamMapper) {
return Try.call(()->{
- try(val inputStream = new FileInputStream(existingFileElseFail(file))){
+ try(var inputStream = new FileInputStream(existingFileElseFail(file))){
return inputStreamMapper.apply(inputStream);
}
});
@@ -87,7 +86,7 @@ public class FileUtils {
*/
public Try<Void> tryReadAndAccept(final @Nullable File file, final @NonNull ThrowingConsumer<InputStream> inputStreamConsumer) {
return Try.run(()->{
- try(val inputStream = new FileInputStream(existingFileElseFail(file))){
+ try(var inputStream = new FileInputStream(existingFileElseFail(file))){
inputStreamConsumer.accept(inputStream);
}
});
@@ -131,7 +130,7 @@ public class FileUtils {
}
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir.toPath())) {
for (Path path : stream) {
- val file = path.toFile();
+ var file = path.toFile();
if (Files.isDirectory(path)) {
if(dirFilter.test(file)) {
// go deeper
@@ -207,7 +206,7 @@ public class FileUtils {
*/
@SneakyThrows
public File tempDir(final String name) {
- val tempDir = Files.createTempDirectory(name).toFile();
+ var tempDir = Files.createTempDirectory(name).toFile();
tempDir.deleteOnExit();
return tempDir;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/HashUtils.java b/commons/src/main/java/org/apache/causeway/commons/io/HashUtils.java
index 509120ddcd..2cd0593d2e 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/HashUtils.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/HashUtils.java
@@ -35,7 +35,6 @@ import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Value;
-import lombok.val;
import lombok.experimental.Accessors;
import lombok.experimental.UtilityClass;
@@ -120,12 +119,12 @@ public class HashUtils {
if(_NullSafe.isEmpty(bytes)) {
return bytes;
}
- val messageDigest = algorithm.tryGetMessageDigest().valueAsNonNullElseFail();
+ var messageDigest = algorithm.tryGetMessageDigest().valueAsNonNullElseFail();
try(DigestInputStream dis = new DigestInputStream(new ByteArrayInputStream(bytes), messageDigest)){
byte[] buffer = new byte[buffersize];
while(dis.read(buffer)>0);
}
- val digestBytes = messageDigest.digest();
+ var digestBytes = messageDigest.digest();
return digestBytes;
});
}
@@ -140,8 +139,8 @@ public class HashUtils {
final int buffersize) {
return Try.call(()->{
- val messageDigest = algorithm.tryGetMessageDigest().valueAsNonNullElseFail();
- val digestBytes = dataSource.tryReadAndApply(inputStream->{
+ var messageDigest = algorithm.tryGetMessageDigest().valueAsNonNullElseFail();
+ var digestBytes = dataSource.tryReadAndApply(inputStream->{
if(inputStream==null) {
return null;
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/JaxbUtils.java b/commons/src/main/java/org/apache/causeway/commons/io/JaxbUtils.java
index 1337bab007..5bf9dae0ce 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/JaxbUtils.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/JaxbUtils.java
@@ -66,7 +66,6 @@ import lombok.Data;
import lombok.NonNull;
import lombok.Singular;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -120,9 +119,9 @@ public class JaxbUtils {
}
@SneakyThrows
private Marshaller marshaller(final JAXBContext jaxbContext, final Class<?> mappedType) {
- val marshaller = jaxbContext.createMarshaller();
+ var marshaller = jaxbContext.createMarshaller();
if(properties!=null) {
- for(val entry : properties.entrySet()) {
+ for(var entry : properties.entrySet()) {
marshaller.setProperty(entry.getKey(), entry.getValue());
}
}
@@ -133,9 +132,9 @@ public class JaxbUtils {
}
@SneakyThrows
private Unmarshaller unmarshaller(final JAXBContext jaxbContext, final Class<?> mappedType) {
- val unmarshaller = jaxbContext.createUnmarshaller();
+ var unmarshaller = jaxbContext.createUnmarshaller();
if(properties!=null) {
- for(val entry : properties.entrySet()) {
+ for(var entry : properties.entrySet()) {
unmarshaller.setProperty(entry.getKey(), entry.getValue());
}
}
@@ -151,7 +150,7 @@ public class JaxbUtils {
}
@SneakyThrows
private <T> T unmarshalTypesafe(final Unmarshaller unmarshaller, final Class<T> mappedType, final InputStream is) {
- val xsr = _DocumentFactories.xmlInputFactory().createXMLStreamReader(is);
+ var xsr = _DocumentFactories.xmlInputFactory().createXMLStreamReader(is);
final JAXBElement<T> userElement = unmarshaller.unmarshal(xsr, mappedType);
return userElement.getValue();
}
@@ -159,10 +158,10 @@ public class JaxbUtils {
private <T> void marshal(final Marshaller marshaller, final T pojo, final OutputStream os) {
marshallerConfigurer.accept(marshaller);
@SuppressWarnings("unchecked")
- val mappedType = (Class<T>)pojo.getClass();
+ var mappedType = (Class<T>)pojo.getClass();
if(shouldMissingXmlRootElementBeHandledOn(mappedType)) {
- val qName = new QName("", mappedType.getSimpleName());
- val jaxbElement = new JAXBElement<T>(qName, mappedType, null, pojo);
+ var qName = new QName("", mappedType.getSimpleName());
+ var jaxbElement = new JAXBElement<T>(qName, mappedType, null, pojo);
marshaller.marshal(jaxbElement, os);
} else {
marshaller.marshal(pojo, os);
@@ -173,7 +172,7 @@ public class JaxbUtils {
}
private <T> void marshal(final JAXBContext jaxbContext, final T pojo, final OutputStream os) {
@SuppressWarnings("unchecked")
- val mappedType = (Class<T>)pojo.getClass();
+ var mappedType = (Class<T>)pojo.getClass();
marshal(marshaller(jaxbContext, mappedType), pojo, os);
}
private <T> T unmarshal(final Class<T> mappedType, final InputStream is) {
@@ -181,7 +180,7 @@ public class JaxbUtils {
}
private <T> void marshal(final T pojo, final OutputStream os) {
@SuppressWarnings("unchecked")
- val mappedType = (Class<T>)pojo.getClass();
+ var mappedType = (Class<T>)pojo.getClass();
marshal(jaxbContext(mappedType), pojo, os);
}
}
@@ -207,8 +206,8 @@ public class JaxbUtils {
public <T> DtoMapper<T> mapperFor(final @NonNull Class<T> mappedType, final JaxbUtils.JaxbCustomizer ... customizers) {
- val opts = createOptions(customizers);
- val jaxbContext = opts.jaxbContext(mappedType); // cached with this instance of DtoMapper
+ var opts = createOptions(customizers);
+ var jaxbContext = opts.jaxbContext(mappedType); // cached with this instance of DtoMapper
return new DtoMapper<T>() {
@@ -253,7 +252,7 @@ public class JaxbUtils {
final @NonNull DataSource source,
final JaxbUtils.JaxbCustomizer ... customizers) {
return source.tryReadAll((final InputStream is)->{
- val opts = createOptions(customizers);
+ var opts = createOptions(customizers);
return Try.call(()->opts.unmarshal(mappedType, is))
.mapFailure(cause->verboseException("unmarshalling XML", mappedType, cause));
});
@@ -269,7 +268,7 @@ public class JaxbUtils {
final @NonNull DataSink sink,
final JaxbUtils.JaxbCustomizer ... customizers) {
if(pojo==null) return;
- val opts = createOptions(customizers);
+ var opts = createOptions(customizers);
try {
sink.writeAll(os->opts.marshal(pojo, os));
} catch (Exception cause) {
@@ -286,7 +285,7 @@ public class JaxbUtils {
final @Nullable T pojo,
final JaxbUtils.JaxbCustomizer ... customizers) {
if(pojo==null) return null;
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
write(pojo, DataSink.ofStringUtf8Consumer(sb), customizers);
var xml = sb.toString();
@@ -360,7 +359,7 @@ public class JaxbUtils {
*/
public void generateSchema(final @NonNull JAXBContext jaxbContext, final DataSink dataSink) {
dataSink.writeAll(os->{
- val schemaOutputResolver = new SchemaOutputResolver() {
+ var schemaOutputResolver = new SchemaOutputResolver() {
@Override
public Result createOutput(final String namespaceURI, final String suggestedFileName) {
return new StreamResult(os);
@@ -390,7 +389,7 @@ public class JaxbUtils {
try {
return (JAXBContext) JAXB_CONTEXT_FACTORY_METHOD_HANDLE.invoke(open(classesToBeBound), JAXB_CONTEXT_FACTORY_PROPS);
} catch (Exception e) {
- val msg = String.format("obtaining JAXBContext for classes (to be bound) {%s}", _NullSafe.stream(classesToBeBound)
+ var msg = String.format("obtaining JAXBContext for classes (to be bound) {%s}", _NullSafe.stream(classesToBeBound)
.map(Class::getName)
.collect(Collectors.joining(", ")));
throw verboseException(msg, classesToBeBound[0], e); // assuming we have at least one argument
@@ -433,14 +432,14 @@ public class JaxbUtils {
private static RuntimeException verboseException(final String doingWhat, @Nullable final Class<?> dtoClass, final Throwable cause) {
- val dtoClassName = Optional.ofNullable(dtoClass).map(Class::getName).orElse("unknown");
+ var dtoClassName = Optional.ofNullable(dtoClass).map(Class::getName).orElse("unknown");
if(isIllegalAnnotationsException(cause)) {
// report a better error if possible
// this is done reflectively because on JDK 8 this exception type is only provided by Oracle JDK
try {
- val errors = _Casts.<List<? extends Exception>>uncheckedCast(
+ var errors = _Casts.<List<? extends Exception>>uncheckedCast(
cause.getClass().getMethod("getErrors").invoke(cause));
if(_NullSafe.size(errors)>0) {
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/JsonUtils.java b/commons/src/main/java/org/apache/causeway/commons/io/JsonUtils.java
index 5a34a528dc..857ec50c32 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/JsonUtils.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/JsonUtils.java
@@ -56,7 +56,6 @@ import org.apache.causeway.commons.internal.reflection._Generics;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -125,8 +124,8 @@ public class JsonUtils {
final JsonUtils.JacksonCustomizer ... customizers) {
return source.tryReadAll((final InputStream is)->{
return Try.call(()->{
- val mapper = createJacksonReader(customizers);
- val collectionType = mapper.getTypeFactory().constructCollectionType(List.class, elementType);
+ var mapper = createJacksonReader(customizers);
+ var collectionType = mapper.getTypeFactory().constructCollectionType(List.class, elementType);
return mapper.readValue(is, collectionType);
});
});
@@ -218,7 +217,7 @@ public class JsonUtils {
@Override
public Can<?> deserialize(
final JsonParser p, final DeserializationContext ctxt) throws IOException {
- val listType = ctxt.getTypeFactory().constructCollectionType(List.class, elementType);
+ var listType = ctxt.getTypeFactory().constructCollectionType(List.class, elementType);
var list = ctxt.readValue(p, listType);
return Can.ofCollection(_Casts.uncheckedCast(list));
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/TextUtils.java b/commons/src/main/java/org/apache/causeway/commons/io/TextUtils.java
index cc40aa8d73..5dccc96043 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/TextUtils.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/TextUtils.java
@@ -45,7 +45,6 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NonNull;
import lombok.SneakyThrows;
-import lombok.val;
import lombok.experimental.UtilityClass;
/**
@@ -93,7 +92,7 @@ public class TextUtils {
if(input==null) {
return Can.empty();
}
- val lines = new ArrayList<String>();
+ var lines = new ArrayList<String>();
try(Scanner scanner = new Scanner(input, charset.name())){
scanner.useDelimiter("\\n");
while(scanner.hasNext()) {
@@ -120,7 +119,7 @@ public class TextUtils {
final @NonNull Class<?> resourceLocation,
final @NonNull String resourceName,
final @NonNull Charset charset) {
- try(val input = resourceLocation.getResourceAsStream(resourceName)){
+ try(var input = resourceLocation.getResourceAsStream(resourceName)){
return readLinesFromInputStream(input, charset);
}
}
@@ -136,7 +135,7 @@ public class TextUtils {
public Can<String> readLinesFromUrl(
final @NonNull URL url,
final @NonNull Charset charset) {
- try(val input = url.openStream()){
+ try(var input = url.openStream()){
return readLinesFromInputStream(input, charset);
}
}
@@ -152,7 +151,7 @@ public class TextUtils {
public Can<String> readLinesFromFile(
final @NonNull File file,
final @NonNull Charset charset) {
- try(val input = new FileInputStream(file)){
+ try(var input = new FileInputStream(file)){
return readLinesFromInputStream(input, charset);
}
}
@@ -183,8 +182,8 @@ public class TextUtils {
final @NonNull File file,
final @NonNull Charset charset) {
- try(val bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset))) {
- for(val line : lines) {
+ try(var bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset))) {
+ for(var line : lines) {
bw.append(line).append("\n");
}
}
@@ -200,8 +199,8 @@ public class TextUtils {
final @NonNull Charset charset) {
dataSink.writeAll(os->{
- try(val bw = new BufferedWriter(new OutputStreamWriter(os, charset))) {
- for(val line : lines) {
+ try(var bw = new BufferedWriter(new OutputStreamWriter(os, charset))) {
+ for(var line : lines) {
bw.append(line).append("\n");
}
}
diff --git a/commons/src/main/java/org/apache/causeway/commons/io/ZipUtils.java b/commons/src/main/java/org/apache/causeway/commons/io/ZipUtils.java
index b7c940741f..98398321cb 100644
--- a/commons/src/main/java/org/apache/causeway/commons/io/ZipUtils.java
+++ b/commons/src/main/java/org/apache/causeway/commons/io/ZipUtils.java
@@ -53,7 +53,6 @@ import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.Value;
-import lombok.val;
import lombok.experimental.Accessors;
import lombok.experimental.UtilityClass;
@@ -95,7 +94,7 @@ public class ZipUtils {
@Override
public <T> Try<T> tryReadAll(@NonNull final Function<InputStream, Try<T>> consumingMapper) {
try {
- try(val bis = new ByteArrayInputStream(bytes)){
+ try(var bis = new ByteArrayInputStream(bytes)){
return consumingMapper.apply(bis);
}
} catch (Throwable e) {
@@ -139,7 +138,7 @@ public class ZipUtils {
final @NonNull DataSource zippedSource,
final @NonNull ZipOptions zipOptions) {
- val zipEntryDataSources = _Lists.<ZipEntryDataSource>newArrayList();
+ var zipEntryDataSources = _Lists.<ZipEntryDataSource>newArrayList();
zippedSource.consumeAsFile(zipFile->{
try (FileSystem fs = FileSystems.newFileSystem(zipFile.toPath(), null)) {
@@ -168,7 +167,7 @@ public class ZipUtils {
final @NonNull DataSource zippedSource,
final @NonNull ZipOptions zipOptions) {
- val zipEntryDataSources = _Lists.<ZipEntryDataSource>newArrayList();
+ var zipEntryDataSources = _Lists.<ZipEntryDataSource>newArrayList();
zippedSource.tryReadAndAccept(is->{
try(final ZipInputStream in = new ZipInputStream(
@@ -207,7 +206,7 @@ public class ZipUtils {
final @NonNull DataSource zippedSource,
final @NonNull ZipOptions zipOptions) {
- val zipEntryDataSources = _Lists.<ZipEntryDataSource>newArrayList(1);
+ var zipEntryDataSources = _Lists.<ZipEntryDataSource>newArrayList(1);
zippedSource.tryReadAndAccept(is->{
try(final ZipInputStream in = new ZipInputStream(
@@ -242,7 +241,7 @@ public class ZipUtils {
// -- WRITING
public static byte[] zipToBytes(final @NonNull Stream<ZipEntryDataSource> entryStream) {
- val buffer = DataPeer.inMemory(16*1024); // 16k default
+ var buffer = DataPeer.inMemory(16*1024); // 16k default
writeTo(entryStream, buffer);
return buffer.bytes();
}
@@ -250,7 +249,7 @@ public class ZipUtils {
@SneakyThrows
public static void writeTo(final @NonNull Stream<ZipEntryDataSource> entryStream, final @NonNull DataSink dataSink) {
dataSink.writeAll(os->{
- try(val zos = new ZipOutputStream(os)) {
+ try(var zos = new ZipOutputStream(os)) {
entryStream.forEach(entry->entry.writeTo(zos));
}
});
diff --git a/commons/src/test/java/org/apache/causeway/commons/collections/CanTest.java b/commons/src/test/java/org/apache/causeway/commons/collections/CanTest.java
index 9a0223dbf2..09a3a40900 100644
--- a/commons/src/test/java/org/apache/causeway/commons/collections/CanTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/collections/CanTest.java
@@ -49,7 +49,6 @@ import org.apache.causeway.commons.internal.testing._SerializationTester;
import lombok.RequiredArgsConstructor;
import lombok.Value;
-import lombok.val;
class CanTest {
@@ -153,9 +152,9 @@ class CanTest {
final Can<String> all = Can.<String>of("a", "b", "c");
- val iterator = all.reverseIterator();
+ var iterator = all.reverseIterator();
- val partialSums = Stream.iterate(
+ var partialSums = Stream.iterate(
Can.<String>empty(),
parts->parts.add(0, iterator.next()))
.limit(4)
@@ -175,8 +174,8 @@ class CanTest {
@Test
void multiCan_toSet_should_find_duplicates() {
- val expectedSet = _Sets.of("a", "b", "c");
- val duplicates = _Sets.<String>newHashSet();
+ var expectedSet = _Sets.of("a", "b", "c");
+ var duplicates = _Sets.<String>newHashSet();
assertSetEquals(expectedSet, Can.<String>of("a", "c", "b", "a").toSet());
assertSetEquals(expectedSet, Can.<String>of("a", "c", "b", "a").toSet(duplicates::add));
diff --git a/commons/src/test/java/org/apache/causeway/commons/collections/CanVectorTest.java b/commons/src/test/java/org/apache/causeway/commons/collections/CanVectorTest.java
index 43de32d6f6..22efd23519 100644
--- a/commons/src/test/java/org/apache/causeway/commons/collections/CanVectorTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/collections/CanVectorTest.java
@@ -24,8 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.causeway.commons.internal.testing._SerializationTester;
-import lombok.val;
-
class CanVectorTest {
@Test
@@ -41,7 +39,7 @@ class CanVectorTest {
@Test
void populatedCanVector_shouldBeSerializable() {
- val vector = new CanVector<String>(3);
+ var vector = new CanVector<String>(3);
vector.set(0, Can.<String>of("hi"));
vector.set(1, Can.<String>of("hi", "there"));
_SerializationTester.assertEqualsOnRoundtrip(Can.<String>of("hi"));
diff --git a/commons/src/test/java/org/apache/causeway/commons/functional/ThrowingRunnableTest.java b/commons/src/test/java/org/apache/causeway/commons/functional/ThrowingRunnableTest.java
index d617ac2a39..b245a094cc 100644
--- a/commons/src/test/java/org/apache/causeway/commons/functional/ThrowingRunnableTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/functional/ThrowingRunnableTest.java
@@ -27,14 +27,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
-import lombok.val;
-
class ThrowingRunnableTest {
@Test
void happyCase() throws Exception {
- val counter = new LongAdder();
+ var counter = new LongAdder();
var throwingRunnable = (ThrowingRunnable) counter::increment;
throwingRunnable.toCallable().call();
diff --git a/commons/src/test/java/org/apache/causeway/commons/handlers/ChainOfResponsibilityTest.java b/commons/src/test/java/org/apache/causeway/commons/handlers/ChainOfResponsibilityTest.java
index 85ae6b32d9..ae0188a38f 100644
--- a/commons/src/test/java/org/apache/causeway/commons/handlers/ChainOfResponsibilityTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/handlers/ChainOfResponsibilityTest.java
@@ -29,14 +29,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.causeway.commons.handler.ChainOfResponsibility;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
-import lombok.val;
-
class ChainOfResponsibilityTest {
@Test
void threeHandlers_shouldProperlyTakeResponsibilityInOrder() {
- val aToUpperCase = new ChainOfResponsibility.Handler<String, String>() {
+ var aToUpperCase = new ChainOfResponsibility.Handler<String, String>() {
@Override
public boolean isHandling(final String request) {
@@ -50,7 +48,7 @@ class ChainOfResponsibilityTest {
};
- val bToUpperCase = new ChainOfResponsibility.Handler<String, String>() {
+ var bToUpperCase = new ChainOfResponsibility.Handler<String, String>() {
@Override
public boolean isHandling(final String request) {
@@ -64,7 +62,7 @@ class ChainOfResponsibilityTest {
};
- val finallyNoop = new ChainOfResponsibility.Handler<String, String>() {
+ var finallyNoop = new ChainOfResponsibility.Handler<String, String>() {
@Override
public boolean isHandling(final String request) {
@@ -78,7 +76,7 @@ class ChainOfResponsibilityTest {
};
- val chainOfResponsibility = ChainOfResponsibility.of(
+ var chainOfResponsibility = ChainOfResponsibility.of(
Arrays.asList(aToUpperCase, bToUpperCase, finallyNoop));
assertEquals("ASTRING", chainOfResponsibility.handle("aString")); // handled by first handler
@@ -95,7 +93,7 @@ class ChainOfResponsibilityTest {
@Test
void whenExtended_shouldWorkAsWell() {
- val aToUpperCase = new StringHandler() {
+ var aToUpperCase = new StringHandler() {
@Override
public boolean isHandling(final String request) {
@@ -109,9 +107,9 @@ class ChainOfResponsibilityTest {
};
- val handlers = Arrays.asList(aToUpperCase);
+ var handlers = Arrays.asList(aToUpperCase);
- val chainOfResponsibility = ChainOfResponsibility.of(handlers);
+ var chainOfResponsibility = ChainOfResponsibility.of(handlers);
assertEquals("ASTRING", chainOfResponsibility.handle("aString")); // handled by first handler
assertThrows(NoSuchElementException.class, ()->chainOfResponsibility.handle("xxx")); // not handled
@@ -120,7 +118,7 @@ class ChainOfResponsibilityTest {
@Test
void handlerExceptions_shouldNoBeSwallowed() {
- val throwingHandler = new ChainOfResponsibility.Handler<String, String>() {
+ var throwingHandler = new ChainOfResponsibility.Handler<String, String>() {
@Override
public boolean isHandling(final String request) {
@@ -134,7 +132,7 @@ class ChainOfResponsibilityTest {
};
- val chainOfResponsibility = ChainOfResponsibility.of(
+ var chainOfResponsibility = ChainOfResponsibility.of(
Arrays.asList(throwingHandler));
assertThrows(RuntimeException.class, ()->chainOfResponsibility.handle("throw"));
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/base/BytesTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/base/BytesTest.java
index 8bce7584e6..4e3143bacd 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/base/BytesTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/base/BytesTest.java
@@ -35,8 +35,6 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import org.apache.causeway.commons.internal._Constants;
-import lombok.val;
-
class BytesTest {
final int n = 256;
@@ -144,7 +142,7 @@ class BytesTest {
@ParameterizedTest
@ValueSource(ints = {0, 1, 2, 3, 4, 5, 6}) // data indices
void compressionRundtrip(final int dataIndex) throws Exception {
- val input = data(dataIndex);
+ var input = data(dataIndex);
assertArrayEquals(input,
_Bytes.decompress(_Bytes.compress(input)));
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/base/TemporalsTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/base/TemporalsTest.java
index ae3f9c71d3..887cb798c6 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/base/TemporalsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/base/TemporalsTest.java
@@ -30,27 +30,25 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import lombok.val;
-
class TemporalsTest {
@Test
void roundtripOffsetTime() {
- for(val temporal: _Temporals.sampleOffsetTime()) {
+ for(var temporal: _Temporals.sampleOffsetTime()) {
assertEquals(temporal, _Temporals.destringAsOffsetTime(_Temporals.enstringOffsetTime(temporal)));
}
}
@Test
void roundtripOffsetDateTime() {
- for(val temporal: _Temporals.sampleOffsetDateTime()) {
+ for(var temporal: _Temporals.sampleOffsetDateTime()) {
assertEquals(temporal, _Temporals.destringAsOffsetDateTime(_Temporals.enstringOffsetDateTime(temporal)));
}
}
@Test
void roundtripZonedDateTime() {
- for(val temporal: _Temporals.sampleZonedDateTime()) {
+ for(var temporal: _Temporals.sampleZonedDateTime()) {
assertEquals(temporal, _Temporals.destringAsZonedDateTime(_Temporals.enstringZonedDateTime(temporal)));
}
}
@@ -80,9 +78,9 @@ class TemporalsTest {
void timeZoneRendering() {
// given
- val dummyDate = LocalDate.of(2022, 1, 28);
- val dummyTime = LocalTime.of(12, 31);
- val formatter = _Temporals.DEFAULT_ZONEID_ONLY_FORMAT;
+ var dummyDate = LocalDate.of(2022, 1, 28);
+ var dummyTime = LocalTime.of(12, 31);
+ var formatter = _Temporals.DEFAULT_ZONEID_ONLY_FORMAT;
// then
assertEquals(
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/base/debug/XrayUiTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/base/debug/XrayUiTest.java
index 208b3fe6e5..c6b85b01c9 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/base/debug/XrayUiTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/base/debug/XrayUiTest.java
@@ -31,14 +31,12 @@ import org.apache.causeway.commons.internal.debug.xray.XrayModel;
import org.apache.causeway.commons.internal.debug.xray.XrayModel.Stickiness;
import org.apache.causeway.commons.internal.debug.xray.XrayUi;
-import lombok.val;
-
class XrayUiTest {
public static void main(final String[] args) throws InterruptedException {
XrayUi.start(JFrame.EXIT_ON_CLOSE);
- val ex = Executors.newSingleThreadExecutor();
+ var ex = Executors.newSingleThreadExecutor();
ex.execute(new SampleLogs());
ex.shutdown();
ex.awaitTermination(1L, TimeUnit.SECONDS);
@@ -66,14 +64,14 @@ class XrayUiTest {
private static void populate(final XrayModel model) {
- val root = model.getRootNode();
+ var root = model.getRootNode();
- val keyValueData = model.addDataNode(
+ var keyValueData = model.addDataNode(
root, new XrayDataModel.KeyValue("id1", "KeyValue", Stickiness.CANNOT_DELETE_NODE));
keyValueData.getData().put("hi", "there");
keyValueData.getData().put("how", "you");
- val sequenceData = model.addDataNode(
+ var sequenceData = model.addDataNode(
root, new XrayDataModel.Sequence("id2", "Sequence", Stickiness.CANNOT_DELETE_NODE))
.getData();
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/binding/BindableTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/binding/BindableTest.java
index 8758f4727a..adbfcfd035 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/binding/BindableTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/binding/BindableTest.java
@@ -29,18 +29,16 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.causeway.commons.collections.Can;
-import lombok.val;
-
class BindableTest {
@Test
void unidirectionalBinding() {
- val primaryChangeCounter = new LongAdder();
- val secondaryChangeCounter = new LongAdder();
+ var primaryChangeCounter = new LongAdder();
+ var secondaryChangeCounter = new LongAdder();
- val primary = _Bindables.forValue("hello");
- val secondary = _Bindables.forValue("");
+ var primary = _Bindables.forValue("hello");
+ var secondary = _Bindables.forValue("");
primary.addListener((e,o,n)->primaryChangeCounter.increment());
secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
@@ -86,11 +84,11 @@ class BindableTest {
@Test
void bidirectionalBinding() {
- val primaryChangeCounter = new LongAdder();
- val secondaryChangeCounter = new LongAdder();
+ var primaryChangeCounter = new LongAdder();
+ var secondaryChangeCounter = new LongAdder();
- val primary = _Bindables.forValue("hello");
- val secondary = _Bindables.forValue("");
+ var primary = _Bindables.forValue("hello");
+ var secondary = _Bindables.forValue("");
primary.addListener((e,o,n)->primaryChangeCounter.increment());
secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
@@ -136,11 +134,11 @@ class BindableTest {
@Test
void unidirectionalBinding_onCan() {
- val primaryChangeCounter = new LongAdder();
- val secondaryChangeCounter = new LongAdder();
+ var primaryChangeCounter = new LongAdder();
+ var secondaryChangeCounter = new LongAdder();
- val primary = _Bindables.forValue(Can.<String>of("hello"));
- val secondary = _Bindables.forValue(Can.<String>empty());
+ var primary = _Bindables.forValue(Can.<String>of("hello"));
+ var secondary = _Bindables.forValue(Can.<String>empty());
primary.addListener((e,o,n)->primaryChangeCounter.increment());
secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
@@ -186,11 +184,11 @@ class BindableTest {
@Test
void bidirectionalBinding_onCan() {
- val primaryChangeCounter = new LongAdder();
- val secondaryChangeCounter = new LongAdder();
+ var primaryChangeCounter = new LongAdder();
+ var secondaryChangeCounter = new LongAdder();
- val primary = _Bindables.forValue(Can.<String>of("hello"));
- val secondary = _Bindables.forValue(Can.<String>empty());
+ var primary = _Bindables.forValue(Can.<String>of("hello"));
+ var secondary = _Bindables.forValue(Can.<String>empty());
primary.addListener((e,o,n)->primaryChangeCounter.increment());
secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
@@ -236,13 +234,13 @@ class BindableTest {
@Test
void bidirectionalBinding_withSynchronizedView() {
- val primaryChangeCounter = new LongAdder();
- val secondaryChangeCounter = new LongAdder();
+ var primaryChangeCounter = new LongAdder();
+ var secondaryChangeCounter = new LongAdder();
- val primary = _Bindables.forValue(Integer.valueOf(3));
- val secondary = _Bindables.forValue(Integer.valueOf(0));
+ var primary = _Bindables.forValue(Integer.valueOf(3));
+ var secondary = _Bindables.forValue(Integer.valueOf(0));
- val view = primary.<String>mapToBindable(i->""+i, Integer::valueOf);
+ var view = primary.<String>mapToBindable(i->""+i, Integer::valueOf);
primary.addListener((e,o,n)->primaryChangeCounter.increment());
secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/collections/Samples.java b/commons/src/test/java/org/apache/causeway/commons/internal/collections/Samples.java
index 0635f99a00..7d1d9a1cab 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/collections/Samples.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/collections/Samples.java
@@ -28,7 +28,6 @@ import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import lombok.val;
import lombok.experimental.UtilityClass;
@UtilityClass
@@ -73,9 +72,9 @@ class Samples {
List<Integer[]> bs,
IndexedBiConsumer<Integer[], Integer[]> probe) {
int i=0;
- for(val a : as) {
+ for(var a : as) {
int j=0;
- for(val b : bs) {
+ for(var b : bs) {
probe.accept(i, j++, a, b);
}
i++;
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ArraysTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ArraysTest.java
index 0c3de095ff..b8443ceb11 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ArraysTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ArraysTest.java
@@ -40,8 +40,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.causeway.commons.internal.base._NullSafe;
import org.apache.causeway.commons.internal.collections.Samples.FiniteSpace2;
-import lombok.val;
-
/**
* @since Feb 22, 2020
*
@@ -278,42 +276,42 @@ class _ArraysTest {
*/
@Test
void removeByIndex_head() {
- val input = new Integer[] {0, 1, 2, 3};
- val output = _Arrays.removeByIndex(input, 0);
+ var input = new Integer[] {0, 1, 2, 3};
+ var output = _Arrays.removeByIndex(input, 0);
assertArrayEquals(new Integer[] {1, 2, 3}, output);
}
@Test
void removeByIndex_inBetween() {
- val input = new Integer[] {0, 1, 2, 3};
- val output = _Arrays.removeByIndex(input, 1);
+ var input = new Integer[] {0, 1, 2, 3};
+ var output = _Arrays.removeByIndex(input, 1);
assertArrayEquals(new Integer[] {0, 2, 3}, output);
}
@Test
void removeByIndex_tail() {
- val input = new Integer[] {0, 1, 2, 3};
- val output = _Arrays.removeByIndex(input, 3);
+ var input = new Integer[] {0, 1, 2, 3};
+ var output = _Arrays.removeByIndex(input, 3);
assertArrayEquals(new Integer[] {0, 1, 2}, output);
}
@Test
void removeByIndex_outOfBounds() {
- val input = new Integer[] {0, 1, 2, 3};
+ var input = new Integer[] {0, 1, 2, 3};
assertThrows(IllegalArgumentException.class,
()->_Arrays.removeByIndex(input, 4));
}
@Test
void removeByIndex_empty() {
- val input = new Integer[] {};
+ var input = new Integer[] {};
assertThrows(IllegalArgumentException.class,
()->_Arrays.removeByIndex(input, 0));
}
@Test
void removeByIndex_null() {
- val input = (Integer[])null;
+ var input = (Integer[])null;
assertThrows(IllegalArgumentException.class,
()->_Arrays.removeByIndex(input, 0));
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ListsTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ListsTest.java
index 6c2dd9a897..6a0b83b8cf 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ListsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_ListsTest.java
@@ -23,48 +23,46 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import lombok.val;
-
class _ListsTest {
@Test
void varargListFactory() {
- val nullList = _Lists.ofNullable(null);
+ var nullList = _Lists.ofNullable(null);
assertNotNull(nullList);
assertEquals(1, nullList.size());
- val otherList = _Lists.ofNullable(4, 5);
+ var otherList = _Lists.ofNullable(4, 5);
assertNotNull(otherList);
assertEquals(2, otherList.size());
- val biNullList = _Lists.ofNullable(null, null);
+ var biNullList = _Lists.ofNullable(null, null);
assertNotNull(biNullList);
assertEquals(2, biNullList.size());
}
@Test
void singletonListFactory() {
- val emptyList = _Lists.singletonOrElseEmpty(null);
+ var emptyList = _Lists.singletonOrElseEmpty(null);
assertNotNull(emptyList);
assertEquals(0, emptyList.size());
- val otherList = _Lists.singletonOrElseEmpty(6);
+ var otherList = _Lists.singletonOrElseEmpty(6);
assertNotNull(otherList);
assertEquals(1, otherList.size());
}
@Test
void ofArray() {
- val emptyList = _Lists.ofArray(null);
+ var emptyList = _Lists.ofArray(null);
assertNotNull(emptyList);
assertEquals(0, emptyList.size());
- val emptyList2 = _Lists.ofArray(new Integer[] {});
+ var emptyList2 = _Lists.ofArray(new Integer[] {});
assertNotNull(emptyList2);
assertEquals(0, emptyList2.size());
// verify elements are actually copied
- val array = new Integer[] {1, 2, 3};
+ var array = new Integer[] {1, 2, 3};
assertEquals(_Lists.ofArray(new Integer[] {1, 2, 3}), _Lists.ofArray(array));
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_MapsTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_MapsTest.java
index c318bf601c..1ef0474df3 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_MapsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_MapsTest.java
@@ -30,14 +30,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.causeway.commons.collections.Can;
-import lombok.val;
-
class _MapsTest {
@Test
void aliasMap_shouldAllowLookupByAliasKey() {
- val aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
+ var aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
aliasMap.put("key1", "value1");
aliasMap.put("key2", Can.ofArray(new String[] {"alias2a", "alias2b"}), "value2");
@@ -60,7 +58,7 @@ class _MapsTest {
@Test
void aliasMap_shouldAlsoClearAliases() {
- val aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
+ var aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
aliasMap.put("key1", "value1");
aliasMap.put("key2", Can.ofArray(new String[] {"alias2a", "alias2b"}), "value2");
@@ -84,7 +82,7 @@ class _MapsTest {
@Test
void aliasMap_shouldHonorRemoval() {
- val aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
+ var aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
aliasMap.put("key1", "value1");
aliasMap.put("key2", Can.ofArray(new String[] {"alias2a", "alias2b"}), "value2");
@@ -113,7 +111,7 @@ class _MapsTest {
@Test
void aliasMap_shouldThrowOnAliasKeyCollision() {
- val aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
+ var aliasMap = _Maps.<String, String>newAliasMap(HashMap::new);
aliasMap.put("key1", Can.ofArray(new String[] {"alias1a", "alias1b"}), "value1");
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_SetsTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_SetsTest.java
index 8312a77988..c4cfc9a406 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/collections/_SetsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/collections/_SetsTest.java
@@ -35,8 +35,6 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import lombok.val;
-
/**
* @since Feb 23, 2020
*
@@ -60,7 +58,7 @@ class _SetsTest {
void assertUnmodifiable(final Set<Integer> set) {
if(set.size()>0) {
assertThrows(Exception.class, ()->set.clear());
- val iterator = set.iterator();
+ var iterator = set.iterator();
assertThrows(Exception.class, ()->{
iterator.next();
iterator.remove();
@@ -75,7 +73,7 @@ class _SetsTest {
*/
@Test
void testSingleton() {
- val set = _Sets.<Integer>singleton(1);
+ var set = _Sets.<Integer>singleton(1);
assertUnmodifiable(set);
assertEquals(1, set.size());
}
@@ -85,10 +83,10 @@ class _SetsTest {
*/
@Test
void testSingletonOrElseEmpty() {
- val set = _Sets.<Integer>singletonOrElseEmpty(1);
+ var set = _Sets.<Integer>singletonOrElseEmpty(1);
assertUnmodifiable(set);
assertEquals(1, set.size());
- val emptySet = _Sets.<Integer>singletonOrElseEmpty(null);
+ var emptySet = _Sets.<Integer>singletonOrElseEmpty(null);
assertUnmodifiable(emptySet);
assertEquals(0, emptySet.size());
}
@@ -107,7 +105,7 @@ class _SetsTest {
*/
@Test
void testUnmodifiable() {
- val set = _Sets.unmodifiable(Samples.iterable(3, 1, 2));
+ var set = _Sets.unmodifiable(Samples.iterable(3, 1, 2));
assertUnmodifiable(set);
Samples.assertListEquals(List.of(3, 1, 2), set);
}
@@ -117,7 +115,7 @@ class _SetsTest {
*/
@Test
void testNewTreeSet() {
- val set = _Sets.newTreeSet();
+ var set = _Sets.newTreeSet();
assertEquals(TreeSet.class, set.getClass());
}
@@ -126,7 +124,7 @@ class _SetsTest {
*/
@Test
void testNewTreeSetComparatorOfT() {
- val set = _Sets.newTreeSet(Integer::compare);
+ var set = _Sets.newTreeSet(Integer::compare);
assertEquals(TreeSet.class, set.getClass());
}
@@ -135,7 +133,7 @@ class _SetsTest {
*/
@Test
void testNewTreeSetIterableOfT() {
- val set = _Sets.newTreeSet(Samples.iterable(3, 1, 2));
+ var set = _Sets.newTreeSet(Samples.iterable(3, 1, 2));
assertEquals(TreeSet.class, set.getClass());
Samples.assertListEquals(List.of(1, 2, 3), set);
}
@@ -145,7 +143,7 @@ class _SetsTest {
*/
@Test
void testNewTreeSetIterableOfTComparatorOfT() {
- val set = _Sets.newTreeSet(Samples.iterable(3, 1, 2), (a, b)->Integer.compare(b, a));
+ var set = _Sets.newTreeSet(Samples.iterable(3, 1, 2), (a, b)->Integer.compare(b, a));
assertEquals(TreeSet.class, set.getClass());
Samples.assertListEquals(List.of(3, 2, 1), set);
}
@@ -155,7 +153,7 @@ class _SetsTest {
*/
@Test
void testNewHashSet() {
- val set = _Sets.newHashSet();
+ var set = _Sets.newHashSet();
assertEquals(HashSet.class, set.getClass());
}
@@ -165,7 +163,7 @@ class _SetsTest {
@Test
void testNewHashSetCollectionOfT() {
assertEquals(HashSet.class, _Sets.newHashSet(null).getClass());
- val set = _Sets.newHashSet(List.of(3, 1, 2, 3, 3));
+ var set = _Sets.newHashSet(List.of(3, 1, 2, 3, 3));
assertEquals(HashSet.class, set.getClass());
Samples.assertSetEquals(_Sets.of(1, 2, 3), set);
}
@@ -175,7 +173,7 @@ class _SetsTest {
*/
@Test
void testNewHashSetIterableOfT() {
- val set = _Sets.newHashSet(Samples.iterable(3, 1, 2, 3, 3));
+ var set = _Sets.newHashSet(Samples.iterable(3, 1, 2, 3, 3));
assertEquals(HashSet.class, set.getClass());
Samples.assertSetEquals(_Sets.of(1, 2, 3), set);
}
@@ -185,7 +183,7 @@ class _SetsTest {
*/
@Test
void testNewLinkedHashSet() {
- val set = _Sets.newLinkedHashSet();
+ var set = _Sets.newLinkedHashSet();
assertEquals(LinkedHashSet.class, set.getClass());
}
@@ -195,7 +193,7 @@ class _SetsTest {
@Test
void testNewLinkedHashSetCollectionOfT() {
assertEquals(LinkedHashSet.class, _Sets.newLinkedHashSet(null).getClass());
- val set = _Sets.newLinkedHashSet(List.of(3, 1, 2, 3, 3));
+ var set = _Sets.newLinkedHashSet(List.of(3, 1, 2, 3, 3));
assertEquals(LinkedHashSet.class, set.getClass());
Samples.assertListEquals(List.of(3, 1, 2), set);
}
@@ -205,7 +203,7 @@ class _SetsTest {
*/
@Test
void testNewLinkedHashSetIterableOfT() {
- val set = _Sets.newLinkedHashSet(Samples.iterable(3, 1, 2, 3, 3));
+ var set = _Sets.newLinkedHashSet(Samples.iterable(3, 1, 2, 3, 3));
assertEquals(LinkedHashSet.class, set.getClass());
Samples.assertListEquals(List.of(3, 1, 2), set);
}
@@ -215,7 +213,7 @@ class _SetsTest {
*/
@Test
void testNewConcurrentHashSet() {
- val set = _Sets.newConcurrentHashSet();
+ var set = _Sets.newConcurrentHashSet();
assertEquals(ConcurrentHashMap.KeySetView.class, set.getClass());
}
@@ -224,7 +222,7 @@ class _SetsTest {
*/
@Test
void testNewConcurrentHashSetCollectionOfT() {
- val set = _Sets.newConcurrentHashSet(Samples.iterable(3, 1, 2, 3, 3));
+ var set = _Sets.newConcurrentHashSet(Samples.iterable(3, 1, 2, 3, 3));
assertEquals(ConcurrentHashMap.KeySetView.class, set.getClass());
Samples.assertSetEquals(_Sets.of(1, 2, 3), set);
}
@@ -234,7 +232,7 @@ class _SetsTest {
*/
@Test
void testNewConcurrentHashSetIterableOfT() {
- val set = _Sets.newConcurrentHashSet(List.of(3, 1, 2, 3, 3));
+ var set = _Sets.newConcurrentHashSet(List.of(3, 1, 2, 3, 3));
assertEquals(ConcurrentHashMap.KeySetView.class, set.getClass());
Samples.assertSetEquals(_Sets.of(1, 2, 3), set);
}
@@ -244,7 +242,7 @@ class _SetsTest {
*/
@Test
void testNewCopyOnWriteArraySet() {
- val set = _Sets.newCopyOnWriteArraySet();
+ var set = _Sets.newCopyOnWriteArraySet();
assertEquals(CopyOnWriteArraySet.class, set.getClass());
}
@@ -254,7 +252,7 @@ class _SetsTest {
@Test
void testNewCopyOnWriteArraySetCollectionOfT() {
assertEquals(CopyOnWriteArraySet.class, _Sets.newCopyOnWriteArraySet(null).getClass());
- val set = _Sets.newCopyOnWriteArraySet(List.of(3, 1, 2, 3, 3));
+ var set = _Sets.newCopyOnWriteArraySet(List.of(3, 1, 2, 3, 3));
assertEquals(CopyOnWriteArraySet.class, set.getClass());
Samples.assertListEquals(List.of(3, 1, 2), set);
}
@@ -264,7 +262,7 @@ class _SetsTest {
*/
@Test
void testNewCopyOnWriteArraySetIterableOfT() {
- val set = _Sets.newCopyOnWriteArraySet(Samples.iterable(3, 1, 2, 3, 3));
+ var set = _Sets.newCopyOnWriteArraySet(Samples.iterable(3, 1, 2, 3, 3));
assertEquals(CopyOnWriteArraySet.class, set.getClass());
Samples.assertListEquals(List.of(3, 1, 2), set);
}
@@ -327,7 +325,7 @@ class _SetsTest {
*/
@Test
void testMinusSetOfTSetOfTSupplierOfSetOfT() {
- val set = _Sets.<Integer>minus(null, null, TreeSet::new);
+ var set = _Sets.<Integer>minus(null, null, TreeSet::new);
assertUnmodifiable(set);
Samples.assertSetEquals(_Sets.of(), _Sets.minus(_Sets.newTreeSet(_Sets.of(1)), null, TreeSet::new));
}
@@ -337,7 +335,7 @@ class _SetsTest {
*/
@Test
void testMinusSortedSortedSetOfTSortedSetOfTSupplierOfSortedSetOfT() {
- val set = _Sets.<Integer>minusSorted(null, null, TreeSet::new);
+ var set = _Sets.<Integer>minusSorted(null, null, TreeSet::new);
assertUnmodifiable(set);
Samples.assertListEquals(List.of(1), _Sets.minusSorted(_Sets.newTreeSet(_Sets.of(1)), null, TreeSet::new));
}
@@ -347,17 +345,17 @@ class _SetsTest {
*/
@Test
void testToUnmodifiableSupplierOfSetOfT() {
- val set = Stream.of(3,1,2)
+ var set = Stream.of(3,1,2)
.collect(_Sets.toUnmodifiable(HashSet::new));
assertUnmodifiable(set);
Samples.assertSetEquals(_Sets.of(1, 2, 3), set);
- val sortedSet = Stream.of(3,1,2)
+ var sortedSet = Stream.of(3,1,2)
.collect(_Sets.toUnmodifiable(TreeSet::new));
assertUnmodifiable(sortedSet);
Samples.assertListEquals(List.of(1, 2, 3), sortedSet);
- val orderedSet = Stream.of(3,1,2)
+ var orderedSet = Stream.of(3,1,2)
.collect(_Sets.toUnmodifiable(LinkedHashSet::new));
assertUnmodifiable(orderedSet);
Samples.assertListEquals(List.of(3, 1, 2), orderedSet);
@@ -369,7 +367,7 @@ class _SetsTest {
*/
@Test
void testToUnmodifiable() {
- val set = Stream.of(3,1,2)
+ var set = Stream.of(3,1,2)
.collect(_Sets.toUnmodifiable(HashSet::new));
assertUnmodifiable(set);
Samples.assertSetEquals(_Sets.of(1, 2, 3), set);
@@ -380,7 +378,7 @@ class _SetsTest {
*/
@Test
void testToUnmodifiablePreservingOrder() {
- val orderedSet = Stream.of(3,1,2)
+ var orderedSet = Stream.of(3,1,2)
.collect(_Sets.toUnmodifiablePreservingOrder());
assertUnmodifiable(orderedSet);
Samples.assertListEquals(List.of(3, 1, 2), orderedSet);
@@ -391,7 +389,7 @@ class _SetsTest {
*/
@Test
void testToUnmodifiableSortedSupplierOfSortedSetOfT() {
- val sortedSet = Stream.of(3,1,2)
+ var sortedSet = Stream.of(3,1,2)
.collect(_Sets.toUnmodifiableSorted(TreeSet::new));
assertUnmodifiable(sortedSet);
Samples.assertListEquals(List.of(1, 2, 3), sortedSet);
@@ -402,7 +400,7 @@ class _SetsTest {
*/
@Test
void testToUnmodifiableSorted() {
- val sortedSet = Stream.of(3,1,2)
+ var sortedSet = Stream.of(3,1,2)
.collect(_Sets.toUnmodifiableSorted());
assertUnmodifiable(sortedSet);
Samples.assertListEquals(List.of(1, 2, 3), sortedSet);
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/collections/snapshot/VersionedListTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/collections/snapshot/VersionedListTest.java
index 116195620a..3e473b9a8a 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/collections/snapshot/VersionedListTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/collections/snapshot/VersionedListTest.java
@@ -26,14 +26,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import lombok.val;
-
class VersionedListTest {
@Test
void test() {
- val vList = new _VersionedList<String>();
+ var vList = new _VersionedList<String>();
assertEquals(0, vList.size());
assertTrue(vList.isEmpty());
@@ -43,25 +41,25 @@ class VersionedListTest {
assertEquals(1, vList.size());
assertFalse(vList.isEmpty());
- val snapshot1 = vList.snapshot();
+ var snapshot1 = vList.snapshot();
assertEquals(1, snapshot1.stream().count());
vList.add("bar");
- val snapshot2 = vList.snapshot();
+ var snapshot2 = vList.snapshot();
assertEquals(2, snapshot2.stream().count());
assertEquals("foo,bar", snapshot2.stream().collect(Collectors.joining(",")));
- val delta = vList.deltaSince(snapshot1);
+ var delta = vList.deltaSince(snapshot1);
assertEquals(1, delta.stream().count());
assertEquals("bar", delta.stream().collect(Collectors.joining(",")));
vList.add("gru");
- val snapshot3 = vList.snapshot();
+ var snapshot3 = vList.snapshot();
assertEquals("foo,bar,gru", snapshot3.stream().collect(Collectors.joining(",")));
- val snapshot4 = vList.deltaSince(snapshot3);
+ var snapshot4 = vList.deltaSince(snapshot3);
assertTrue(snapshot4.isEmpty());
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/concurrent/ConcurrentTaskListTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/concurrent/ConcurrentTaskListTest.java
index 34ac6328b8..a4933356f7 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/concurrent/ConcurrentTaskListTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/concurrent/ConcurrentTaskListTest.java
@@ -24,14 +24,12 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import lombok.val;
-
class ConcurrentTaskListTest {
@Test
void tasksShouldAllBeExecuted() {
- val counter = new LongAdder();
+ var counter = new LongAdder();
_ConcurrentTaskList tasks = _ConcurrentTaskList.named("Test")
.addRunnable("1", counter::increment)
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/debug/xray/CallStackMergerTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/debug/xray/CallStackMergerTest.java
index 258e2d30df..4b8c836015 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/debug/xray/CallStackMergerTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/debug/xray/CallStackMergerTest.java
@@ -27,8 +27,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.causeway.commons.internal.debug.xray._CallStackMerger.IntTreeVisitor;
-import lombok.val;
-
class CallStackMergerTest {
private List<int[]> executionLanes;
@@ -60,10 +58,10 @@ class CallStackMergerTest {
*/
@Test
void test() {
- val root = _CallStackMerger.merge(executionLanes);
+ var root = _CallStackMerger.merge(executionLanes);
//System.err.printf("%s%n", root);
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
root.visitDepthFirst(new IntTreeVisitor() {
@Override
public void accept(final int level, final int value) {
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/image/_ImagesTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/image/_ImagesTest.java
index 4f66b608c2..a92c172e52 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/image/_ImagesTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/image/_ImagesTest.java
@@ -24,17 +24,15 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import lombok.val;
-
class _ImagesTest {
@Test
void pixelRoundtrip() {
// given
- val bufferedImage = getBufferedImage();
+ var bufferedImage = getBufferedImage();
// when
- val imageAfterRoundtrip = _Images.fromPixels(_Images.toPixels(bufferedImage));
+ var imageAfterRoundtrip = _Images.fromPixels(_Images.toPixels(bufferedImage));
// then
assertArrayEquals(getPixels(), _Images.toPixels(imageAfterRoundtrip));
@@ -43,10 +41,10 @@ class _ImagesTest {
@Test
void bytesRoundtrip() {
// given
- val bufferedImage = getBufferedImage();
+ var bufferedImage = getBufferedImage();
// when
- val imageAfterRoundtrip = _Images.fromBytes(_Images.toBytes(bufferedImage));
+ var imageAfterRoundtrip = _Images.fromBytes(_Images.toBytes(bufferedImage));
// then
assertArrayEquals(getPixels(), _Images.toPixels(imageAfterRoundtrip));
@@ -55,10 +53,10 @@ class _ImagesTest {
@Test
void base64Roundtrip() {
// given
- val bufferedImage = getBufferedImage();
+ var bufferedImage = getBufferedImage();
// when
- val imageAfterRoundtrip = _Images.fromBase64(_Images.toBase64(bufferedImage));
+ var imageAfterRoundtrip = _Images.fromBase64(_Images.toBase64(bufferedImage));
// then
assertArrayEquals(getPixels(), _Images.toPixels(imageAfterRoundtrip));
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/primitives/IntsTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/primitives/IntsTest.java
index b40e4ac047..f9fbe92427 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/primitives/IntsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/primitives/IntsTest.java
@@ -25,8 +25,6 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
-import lombok.val;
-
class IntsTest {
@BeforeEach
@@ -39,14 +37,14 @@ class IntsTest {
@Test
void emptyRange() {
- val range = _Ints.rangeOpenEnded(3, 3);
+ var range = _Ints.rangeOpenEnded(3, 3);
assertEquals("[]", range.toString());
}
@Test
void rangeIntersection() {
- val intersection = _Ints.rangeClosed(3, 7)
+ var intersection = _Ints.rangeClosed(3, 7)
.intersect(_Ints.rangeClosed(5, 10))
.get();
@@ -56,7 +54,7 @@ class IntsTest {
@Test
void rangeIntersectionEmpty() {
- val intersection = _Ints.rangeClosed(3, 7)
+ var intersection = _Ints.rangeClosed(3, 7)
.intersect(_Ints.rangeClosed(8, 10));
assertFalse(intersection.isPresent());
@@ -65,7 +63,7 @@ class IntsTest {
@Test
void rangeIntersectionOnBoundary() {
- val intersection = _Ints.rangeClosed(3, 7)
+ var intersection = _Ints.rangeClosed(3, 7)
.intersect(_Ints.rangeClosed(7, 10))
.get();
@@ -75,7 +73,7 @@ class IntsTest {
@Test
void rangeIntersectionContainment() {
- val intersection = _Ints.rangeClosed(3, 10)
+ var intersection = _Ints.rangeClosed(3, 10)
.intersect(_Ints.rangeClosed(5, 7))
.get();
@@ -85,16 +83,16 @@ class IntsTest {
@Test
void rangeIterator() {
- val sb = new StringBuilder();
+ var sb = new StringBuilder();
- val rangeIterator1 = _Ints.rangeClosed(3, 7).iterator();
+ var rangeIterator1 = _Ints.rangeClosed(3, 7).iterator();
while(rangeIterator1.hasNext()) {
sb.append(rangeIterator1.nextInt()).append(',');
}
assertEquals("3,4,5,6,7,", sb.toString());
sb.setLength(0);
- val rangeIterator2 = _Ints.rangeOpenEnded(3, 3).iterator();
+ var rangeIterator2 = _Ints.rangeOpenEnded(3, 3).iterator();
while(rangeIterator2.hasNext()) {
sb.append(rangeIterator2.nextInt()).append(',');
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/AnnotationsTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/AnnotationsTest.java
index 2ff81026cd..2bcbb24660 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/AnnotationsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/AnnotationsTest.java
@@ -32,7 +32,6 @@ import org.apache.causeway.commons.internal._Constants;
import lombok.Getter;
import lombok.Setter;
-import lombok.val;
class AnnotationsTest {
@@ -73,7 +72,7 @@ class AnnotationsTest {
.filter(m->m.getName().equals("action"))
// using filter over peek here, because peek is unreliable with 'count()' terminal
.filter(m->{
- val syn = _Annotations.synthesize(m, DisplayName.class);
+ var syn = _Annotations.synthesize(m, DisplayName.class);
assertNotNull(syn);
assertTrue(syn.isPresent());
assertEquals("hi", syn.get().value());
@@ -93,7 +92,7 @@ class AnnotationsTest {
.filter(m->m.getName().equals("action"))
// using filter over peek here, because peek is unreliable with 'count()' terminal
.filter(m->{
- val syn = _Annotations.synthesize(m, DisplayName.class);
+ var syn = _Annotations.synthesize(m, DisplayName.class);
assertNotNull(syn);
assertTrue(syn.isPresent());
assertEquals("hi", syn.get().value());
@@ -107,7 +106,7 @@ class AnnotationsTest {
@Test
void inhertitedAnnotationWhenOverrideOnBooleanProperty() {
- val getter = ClassUtils
+ var getter = ClassUtils
.getMethod(PrimitiveBooleanEntity.class, "isReadWriteProperty", _Constants.emptyClasses);
assertEquals(43, _Annotations.synthesize(getter, Order.class).get().value());
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/ClassCacheTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/ClassCacheTest.java
index 4ff86862e3..1db3cb3f9e 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/ClassCacheTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/ClassCacheTest.java
@@ -35,7 +35,6 @@ import org.apache.causeway.commons.internal.base._NullSafe;
import org.apache.causeway.commons.internal.reflection._GenericResolver.ResolvedMethod;
import lombok.SneakyThrows;
-import lombok.val;
class ClassCacheTest {
@@ -80,7 +79,7 @@ class ClassCacheTest {
@Test
void inhertitedMethodWhenUsingReflectionUtility() {
- val declaredMethods = Can.ofStream(
+ var declaredMethods = Can.ofStream(
_NullSafe.stream(_Reflect.streamAllMethods(Concrete.class, true)));
assertContainsMethod(declaredMethods, "commonAction");
assertContainsMethod(declaredMethods, "specificAction");
@@ -88,7 +87,7 @@ class ClassCacheTest {
@Test
void inhertitedMethod() {
- val declaredMethods = Can.ofStream(
+ var declaredMethods = Can.ofStream(
classCache.streamResolvedMethods(Concrete.class));
assertContainsResolvedMethod(declaredMethods, "commonAction");
assertContainsResolvedMethod(declaredMethods, "specificAction");
@@ -96,7 +95,7 @@ class ClassCacheTest {
@Test
void inhertitedMethodWhenOverride() {
- val declaredMethods = Can.ofStream(
+ var declaredMethods = Can.ofStream(
classCache.streamResolvedMethods(ConcreteOverride.class));
assertContainsResolvedMethod(declaredMethods, "commonAction");
assertContainsResolvedMethod(declaredMethods, "specificAction");
@@ -116,16 +115,16 @@ class ClassCacheTest {
_Mixins.Task2.Mixin.class,
})
void methodEnumeration(final Class<?> classUnderTest) {
- val declaredMethods = Can.ofStream(
+ var declaredMethods = Can.ofStream(
classCache.streamResolvedMethods(classUnderTest));
- val expectations = extractExpectations(classUnderTest);
+ var expectations = extractExpectations(classUnderTest);
expectations.assertAll(declaredMethods);
}
@Test
void javaLangObjectPublicMethodsAreIgnored() {
- val javaLangObjectPublicMethods = classCache.streamPublicMethods(Object.class)
+ var javaLangObjectPublicMethods = classCache.streamPublicMethods(Object.class)
.collect(Can.toCan());
assertEquals(Can.empty(), javaLangObjectPublicMethods);
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericReflectionMagicTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericReflectionMagicTest.java
index 7040881b00..c9b2c2a782 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericReflectionMagicTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericReflectionMagicTest.java
@@ -27,38 +27,36 @@ import org.springframework.core.MethodParameter;
import org.apache.causeway.commons.collections.Can;
-import lombok.val;
-
class GenericReflectionMagicTest {
@Test
void resolveGenericReturnTypeAndParameterType() {
- val declaredMethodsMatching = Can.ofStream(_Reflect.streamAllMethods(_GenericAbstractImpl.class, true))
+ var declaredMethodsMatching = Can.ofStream(_Reflect.streamAllMethods(_GenericAbstractImpl.class, true))
.filter(m->m.getName().equals("sampleAction4"));
//debug
//declaredMethodsMatching.forEach(m->System.err.printf("%s (%s)%n", _Util.methodSummary(m), m));
assertEquals(1, declaredMethodsMatching.size());
- val sampleAction = declaredMethodsMatching.getFirstElseFail();
+ var sampleAction = declaredMethodsMatching.getFirstElseFail();
- val returnType = GenericTypeResolver.resolveReturnType(sampleAction, _GenericAbstractImpl.class);
+ var returnType = GenericTypeResolver.resolveReturnType(sampleAction, _GenericAbstractImpl.class);
assertEquals(String.class, returnType);
@SuppressWarnings("deprecation") // proposed alternative is not publicly visible
- val param0Type = GenericTypeResolver.resolveParameterType(new MethodParameter(sampleAction, 0), _GenericAbstractImpl.class);
+ var param0Type = GenericTypeResolver.resolveParameterType(new MethodParameter(sampleAction, 0), _GenericAbstractImpl.class);
assertEquals(String.class, param0Type);
}
@Test
void mostSpecificMethodFind() {
- val declaredMethodsMatching = Can.ofStream(_Reflect.streamAllMethods(_GenericAbstractImpl.class, true))
+ var declaredMethodsMatching = Can.ofStream(_Reflect.streamAllMethods(_GenericAbstractImpl.class, true))
.filter(m->m.getName().equals("sampleAction2"));
assertEquals(3, declaredMethodsMatching.size());
//debug
//declaredMethodsMatching.forEach(m->System.err.printf("+ %s bridge->%b%n", m, m.isBridge()));
- val mostSpecific = _ClassCache.getInstance().findMethodUniquelyByNameOrFail(_GenericAbstractImpl.class, "sampleAction2");
+ var mostSpecific = _ClassCache.getInstance().findMethodUniquelyByNameOrFail(_GenericAbstractImpl.class, "sampleAction2");
assertEquals(String.class, mostSpecific.paramType(0));
assertEquals(String.class, mostSpecific.returnType());
}
@@ -66,7 +64,7 @@ class GenericReflectionMagicTest {
@Test
void detectMethodOverride() {
- val declaredMethodsMatching = _ClassCache.getInstance().streamResolvedMethods(_GenericAbstractImpl.class)
+ var declaredMethodsMatching = _ClassCache.getInstance().streamResolvedMethods(_GenericAbstractImpl.class)
.filter(m->m.name().equals("sampleAction2"))
.collect(Can.toCan());
//debug
@@ -74,7 +72,7 @@ class GenericReflectionMagicTest {
assertEquals(1, declaredMethodsMatching.size());
- val mostSpecific = declaredMethodsMatching.getFirstElseFail();
+ var mostSpecific = declaredMethodsMatching.getFirstElseFail();
assertEquals(String.class, mostSpecific.paramType(0));
assertEquals(String.class, mostSpecific.returnType());
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericsTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericsTest.java
index fc69387fb5..abd935d1a5 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/reflection/GenericsTest.java
@@ -28,8 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.causeway.commons.collections.Can;
import org.apache.causeway.commons.internal._Constants;
-import lombok.val;
-
class GenericsTest {
Class<?> typeUnderTest;
@@ -44,7 +42,7 @@ class GenericsTest {
@Test
void streamGenericTypeArgumentsOfType() {
- val actualTypeArgs = _Generics.streamGenericTypeArgumentsOfType(typeUnderTest)
+ var actualTypeArgs = _Generics.streamGenericTypeArgumentsOfType(typeUnderTest)
.collect(Can.toCan());
// impossible, so empty
@@ -54,9 +52,9 @@ class GenericsTest {
@Test
void streamGenericTypeArgumentsOfMethodReturnType() throws NoSuchMethodException, SecurityException {
- val methodUnderTest = this.getClass().getDeclaredMethod("methodUnderTest", _Constants.emptyClasses);
+ var methodUnderTest = this.getClass().getDeclaredMethod("methodUnderTest", _Constants.emptyClasses);
- val actualTypeArgs = _Generics.streamGenericTypeArgumentsOfMethodReturnType(methodUnderTest)
+ var actualTypeArgs = _Generics.streamGenericTypeArgumentsOfMethodReturnType(methodUnderTest)
.collect(Can.toCan());
assertEquals(Can.of(String.class), actualTypeArgs);
@@ -65,9 +63,9 @@ class GenericsTest {
@Test
void streamGenericTypeArgumentsOfField() throws NoSuchFieldException, SecurityException {
- val fieldUnderTest = this.getClass().getDeclaredField("fieldUnderTest");
+ var fieldUnderTest = this.getClass().getDeclaredField("fieldUnderTest");
- val actualTypeArgs = _Generics.streamGenericTypeArgumentsOfField(fieldUnderTest)
+ var actualTypeArgs = _Generics.streamGenericTypeArgumentsOfField(fieldUnderTest)
.collect(Can.toCan());
assertEquals(Can.of(String.class), actualTypeArgs);
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/resources/JsonYamlReaderTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/resources/JsonYamlReaderTest.java
index ebd60b6c71..ef8228ac5d 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/resources/JsonYamlReaderTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/resources/JsonYamlReaderTest.java
@@ -35,7 +35,6 @@ import org.apache.causeway.commons.io.JsonUtils;
import org.apache.causeway.commons.io.YamlUtils;
import lombok.Data;
-import lombok.val;
class JsonYamlReaderTest {
@@ -56,7 +55,7 @@ class JsonYamlReaderTest {
@Test
void loadCustomerFromJson() throws JsonParseException, JsonMappingException, IOException {
- val customer = JsonUtils.tryRead(Customer.class, DataSource.ofResource(this.getClass(), "customer.json"))
+ var customer = JsonUtils.tryRead(Customer.class, DataSource.ofResource(this.getClass(), "customer.json"))
.ifFailureFail()
.getValue()
.orElse(null);
@@ -65,7 +64,7 @@ class JsonYamlReaderTest {
@Test
void loadCustomerFromYaml() {
- val customer = YamlUtils.tryRead(Customer.class, DataSource.ofResource(this.getClass(), "customer.yml"))
+ var customer = YamlUtils.tryRead(Customer.class, DataSource.ofResource(this.getClass(), "customer.yml"))
.ifFailureFail()
.getValue()
.orElse(null);
diff --git a/commons/src/test/java/org/apache/causeway/commons/internal/resources/XmlRoundTripTest.java b/commons/src/test/java/org/apache/causeway/commons/internal/resources/XmlRoundTripTest.java
index 392aaa1ae0..24af9b2182 100644
--- a/commons/src/test/java/org/apache/causeway/commons/internal/resources/XmlRoundTripTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/internal/resources/XmlRoundTripTest.java
@@ -32,14 +32,13 @@ import org.apache.causeway.commons.io.JaxbUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.SneakyThrows;
-import lombok.val;
class XmlRoundTripTest {
@Test @SneakyThrows
void testFrameworkDefault() {
- val dto = getSample();
- val mapper = JaxbUtils
+ var dto = getSample();
+ var mapper = JaxbUtils
.mapperFor(SampleDto.class, opts->opts.allowMissingRootElement(true));
assertEquals(dto, mapper.clone(dto));
}
@@ -55,7 +54,7 @@ class XmlRoundTripTest {
}
private SampleDto getSample() {
- val dto = new SampleDto();
+ var dto = new SampleDto();
dto.setContent("Hallo World!");
return dto;
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java b/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java
index 3ca7fccf80..7616afc1c1 100644
--- a/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/io/JaxbUtilsTest.java
@@ -40,7 +40,6 @@ import org.apache.causeway.commons.io.JaxbUtils.JaxbOptions.JaxbOptionsBuilder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
-import lombok.val;
class JaxbUtilsTest {
@@ -91,14 +90,14 @@ class JaxbUtilsTest {
void typesafeUnmarshallingFromAmbiguousContext() {
// when ... doing a round trip
- val aXml = JaxbUtils.toStringUtf8(a);
- val bXml = JaxbUtils.toStringUtf8(b);
+ var aXml = JaxbUtils.toStringUtf8(a);
+ var bXml = JaxbUtils.toStringUtf8(b);
assertTrue(_Strings.isNotEmpty(aXml));
assertTrue(_Strings.isNotEmpty(bXml));
- val aRecovered = JaxbUtils.tryRead(A.class, aXml).valueAsNonNullElseFail();
- val bRecovered = JaxbUtils.tryRead(B.class, bXml).valueAsNonNullElseFail();
+ var aRecovered = JaxbUtils.tryRead(A.class, aXml).valueAsNonNullElseFail();
+ var bRecovered = JaxbUtils.tryRead(B.class, bXml).valueAsNonNullElseFail();
// then
assertEquals(a, aRecovered);
@@ -109,13 +108,13 @@ class JaxbUtilsTest {
@Test
void toStringUtf8_with_no_options() {
- val aXml = JaxbUtils.toStringUtf8(a);
+ var aXml = JaxbUtils.toStringUtf8(a);
Approvals.verify(aXml);
}
@Test
void toStringUtf8_with_no_formatted_output() {
- val aXml = JaxbUtils.toStringUtf8(a, opt -> {
+ var aXml = JaxbUtils.toStringUtf8(a, opt -> {
opt.formattedOutput(false);
return opt;
});
@@ -124,7 +123,7 @@ class JaxbUtilsTest {
@Test
void toStringUtf8_with_indent_number_overridden() {
- val aXml = JaxbUtils.toStringUtf8(a, new JaxbUtils.TransformerFactoryCustomizer() {
+ var aXml = JaxbUtils.toStringUtf8(a, new JaxbUtils.TransformerFactoryCustomizer() {
@Override
public void apply(final TransformerFactory transformerFactory) {
transformerFactory.setAttribute("indent-number", 2);
diff --git a/commons/src/test/java/org/apache/causeway/commons/io/JsonUtilsTest.java b/commons/src/test/java/org/apache/causeway/commons/io/JsonUtilsTest.java
index ecf1b38b9b..4284274e16 100644
--- a/commons/src/test/java/org/apache/causeway/commons/io/JsonUtilsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/io/JsonUtilsTest.java
@@ -26,8 +26,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.causeway.commons.io._TestDomain.Person;
-import lombok.val;
-
class JsonUtilsTest {
/*
@@ -50,7 +48,7 @@ class JsonUtilsTest {
@Test
void toStringUtf8_indentedOutput() {
- val json = JsonUtils.toStringUtf8(person, JsonUtils::indentedOutput);
+ var json = JsonUtils.toStringUtf8(person, JsonUtils::indentedOutput);
Approvals.verify(json);
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/io/YamlUtilsTest.java b/commons/src/test/java/org/apache/causeway/commons/io/YamlUtilsTest.java
index 0ea013848d..5d12dda8e0 100644
--- a/commons/src/test/java/org/apache/causeway/commons/io/YamlUtilsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/io/YamlUtilsTest.java
@@ -26,8 +26,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.causeway.commons.io._TestDomain.Person;
-import lombok.val;
-
class YamlUtilsTest {
private Person person;
@@ -39,7 +37,7 @@ class YamlUtilsTest {
@Test
void toStringUtf8() {
- val yaml = YamlUtils.toStringUtf8(person);
+ var yaml = YamlUtils.toStringUtf8(person);
Approvals.verify(yaml);
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/io/ZipUtilsTest.java b/commons/src/test/java/org/apache/causeway/commons/io/ZipUtilsTest.java
index 20d7d25a87..b1e7d8aed8 100644
--- a/commons/src/test/java/org/apache/causeway/commons/io/ZipUtilsTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/io/ZipUtilsTest.java
@@ -26,7 +26,6 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import lombok.SneakyThrows;
-import lombok.val;
class ZipUtilsTest {
@@ -34,7 +33,7 @@ class ZipUtilsTest {
@BeforeEach
void setup() {
- val rd = new Random(9999); // fixed seed - reproducible tests
+ var rd = new Random(9999); // fixed seed - reproducible tests
this.bytes = new byte[16*1024];
rd.nextBytes(bytes);
}
@@ -48,7 +47,7 @@ class ZipUtilsTest {
// -- HELPER
private static byte[] zip(final byte[] unzipped) {
- val zipBuilder = ZipUtils.zipEntryBuilder();
+ var zipBuilder = ZipUtils.zipEntryBuilder();
zipBuilder.add("test", unzipped);
return zipBuilder.toBytes();
}
diff --git a/commons/src/test/java/org/apache/causeway/commons/util/StringDelimiterTest.java b/commons/src/test/java/org/apache/causeway/commons/util/StringDelimiterTest.java
index f487a8085c..93220cf664 100644
--- a/commons/src/test/java/org/apache/causeway/commons/util/StringDelimiterTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/util/StringDelimiterTest.java
@@ -25,14 +25,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.causeway.commons.collections.Can;
import org.apache.causeway.commons.io.TextUtils;
-import lombok.val;
-
class StringDelimiterTest {
@Test
void parsing() {
- val delimiter = TextUtils.delimiter(".");
+ var delimiter = TextUtils.delimiter(".");
assertThatDelimiterEquals(delimiter, new String[0]);
assertThatDelimiterEquals(delimiter.parse(null), new String[0]);
@@ -58,7 +56,7 @@ class StringDelimiterTest {
@Test
void joining() {
- val delimiter = TextUtils.delimiter(".");
+ var delimiter = TextUtils.delimiter(".");
assertThatDelimiterEquals(
delimiter.parse(null).join(null), new String[0]);
@@ -83,21 +81,21 @@ class StringDelimiterTest {
@Test
void asDelimitedString() {
- val delimiter = TextUtils.delimiter(".");
+ var delimiter = TextUtils.delimiter(".");
assertEquals("", delimiter.asDelimitedString());
assertEquals("a.b", delimiter.parse("a.b").asDelimitedString());
}
@Test
void withDelimiter() {
- val delimiter = TextUtils.delimiter(".");
+ var delimiter = TextUtils.delimiter(".");
assertEquals("", delimiter.withDelimiter("/").asDelimitedString());
assertEquals("a/b", delimiter.parse("a.b").withDelimiter("/").asDelimitedString());
}
@Test
void toStringMethod() {
- val delimiter = TextUtils.delimiter(".");
+ var delimiter = TextUtils.delimiter(".");
assertEquals("StringDelimiter[delimiter=.,elements=[]]", delimiter.toString());
assertEquals("StringDelimiter[delimiter=.,elements=[a, b]]", delimiter.parse("a.b").toString());
}