This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/main by this push:
new 09b376145c0 CAUSEWAY-2297: removes unused imports
09b376145c0 is described below
commit 09b376145c0e5ea542b661250e9c215acbb5de6c
Author: andi-huber <[email protected]>
AuthorDate: Fri Dec 12 20:11:34 2025 +0100
CAUSEWAY-2297: removes unused imports
---
.../org/apache/causeway/commons/io/JaxbUtils.java | 28 ++++++++--------------
.../apache/causeway/commons/net/DataUriTest.java | 4 +---
.../attributes/temporal/DateTimeConfig.java | 16 ++++---------
3 files changed, 16 insertions(+), 32 deletions(-)
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 f8726d3f1d0..d203efa8f1a 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
@@ -24,7 +24,6 @@
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Collections;
-import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
@@ -206,9 +205,7 @@ public <T> DtoMapper<T> mapperFor(final @NonNull Class<T>
mappedType, final Jaxb
@Override
public T read(final DataSource source) {
- return source.tryReadAll((final InputStream is)->{
- return Try.call(()->opts.unmarshal(jaxbContext,
mappedType, is));
- })
+ return source.tryReadAll((final InputStream is) ->
Try.call(()->opts.unmarshal(jaxbContext, mappedType, is)))
.ifFailureFail()
.getValue().orElseThrow();
}
@@ -281,9 +278,8 @@ public <T> String toStringUtf8(
write(pojo, DataSink.ofStringUtf8Consumer(sb), customizers);
var xml = sb.toString();
- if (isFormattedOutput(customizers)) {
- return prettyPrint(customizers, xml);
- }
+ if (isFormattedOutput(customizers))
+ return prettyPrint(customizers, xml);
return xml;
}
@@ -313,8 +309,7 @@ private static String prettyPrint(final JaxbCustomizer[]
customizers, final Stri
private static void apply(final JaxbCustomizer[] customizers, final
TransformerFactory transformerFactory) {
for (var customizer : customizers) {
- if (customizer instanceof TransformerFactoryCustomizer) {
- var transformerFactoryCustomizer =
(TransformerFactoryCustomizer) customizer;
+ if (customizer instanceof TransformerFactoryCustomizer
transformerFactoryCustomizer) {
transformerFactoryCustomizer.apply(transformerFactory);
}
}
@@ -396,10 +391,9 @@ private static <T> JAXBContext contextOf(final Class<?>
... classesToBeBound) {
private static Class<?>[] open(final Class<?>[] classes) throws
JAXBException {
final Module coreModule = JAXB_CONTEXT_FACTORY.getClass().getModule();
final Module rtModule = JAXBContextFactory.class.getModule();
- if (rtModule == coreModule || !rtModule.isNamed()) {
- //we're either in a bundle or on the classpath
+ if (rtModule == coreModule || !rtModule.isNamed())
+ //we're either in a bundle or on the classpath
return classes;
- }
for (Class<?> cls : classes) {
Class<?> jaxbClass = cls.isArray() ? cls.getComponentType() : cls;
final Module classModule = jaxbClass.getModule();
@@ -411,11 +405,10 @@ private static Class<?>[] open(final Class<?>[] classes)
throws JAXBException {
if (classModule.isOpen(packageName, rtModule)) {
classModule.addOpens(packageName, coreModule);
- } else {
- throw new JAXBException(java.text.MessageFormat.format(
+ } else
+ throw new
JAXBException(java.text.MessageFormat.format(
"Package {0} with class {1} defined in a module {2}
must be open to at least {3} module.",
packageName, jaxbClass.getName(),
classModule.getName(), rtModule.getName()));
- }
}
return classes;
}
@@ -429,8 +422,8 @@ private static RuntimeException verboseException(final
String doingWhat, final @
if(cause instanceof IllegalAnnotationsException annotEx) {
// report a better error if possible
var errors = annotEx.getErrors();
- if(_NullSafe.size(errors)>0) {
- return _Exceptions.unrecoverable(cause,
+ if(_NullSafe.size(errors)>0)
+ return _Exceptions.unrecoverable(cause,
"Error %s, "
+ "due to illegal annotations on object class '%s'; "
+ "%d error(s) reported: %s",
@@ -440,7 +433,6 @@ private static RuntimeException verboseException(final
String doingWhat, final @
errors.stream()
.map(IllegalAnnotationException::toString)
.collect(Collectors.joining("; ")));
- }
}
return _Exceptions.unrecoverable(cause,
diff --git
a/commons/src/test/java/org/apache/causeway/commons/net/DataUriTest.java
b/commons/src/test/java/org/apache/causeway/commons/net/DataUriTest.java
index 3fd6f9b17ef..0b3bc705f85 100644
--- a/commons/src/test/java/org/apache/causeway/commons/net/DataUriTest.java
+++ b/commons/src/test/java/org/apache/causeway/commons/net/DataUriTest.java
@@ -27,8 +27,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.apache.causeway.commons.net.DataUri;
-
import lombok.RequiredArgsConstructor;
class DataUriTest {
@@ -53,7 +51,7 @@ enum Scenario {
@ParameterizedTest
@EnumSource(Scenario.class)
- void rundtrip(Scenario scenario) {
+ void rundtrip(final Scenario scenario) {
var ref = new DataUri(scenario.mediaType, scenario.parameters,
scenario.encoding, scenario.data);
var parsed = DataUri.parse(scenario.externalForm);
assertEquals(scenario.externalForm, ref.toExternalForm());
diff --git
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/attributes/temporal/DateTimeConfig.java
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/attributes/temporal/DateTimeConfig.java
index afc7d3ede74..12fc3e8fffd 100644
---
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/attributes/temporal/DateTimeConfig.java
+++
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/attributes/temporal/DateTimeConfig.java
@@ -18,7 +18,6 @@
*/
package org.apache.causeway.viewer.wicket.ui.components.attributes.temporal;
-import java.io.IOException;
import java.util.Locale;
import java.util.Map;
@@ -433,16 +432,11 @@ private static class TodayButtonSerializer extends
ValueSerializer<TodayButton>
@Override
public void serialize(final TodayButton value, final JsonGenerator
jgen, final SerializationContext provider) throws JacksonException {
switch (value) {
- case TRUE:
- jgen.writeBoolean(true);
- break;
- case FALSE:
- jgen.writeBoolean(false);
- break;
- case LINKED:
- jgen.writeString("linked");
- break;
- }
+ case TRUE -> jgen.writeBoolean(true);
+ case FALSE -> jgen.writeBoolean(false);
+ case LINKED -> jgen.writeString("linked");
+ }
+ ;
}
}