Browse Source

Polish

pull/31513/head
Stéphane Nicoll 11 months ago
parent
commit
24aa6163f0
  1. 5
      spring-core/src/main/java/org/springframework/aot/generate/AppendableConsumerInputStreamSource.java
  2. 2
      spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java
  3. 2
      spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java
  4. 4
      spring-core/src/main/java/org/springframework/aot/hint/ResourcePatternHints.java
  5. 3
      spring-core/src/main/java/org/springframework/aot/hint/support/KotlinDetectorRuntimeHints.java
  6. 3
      spring-core/src/main/java/org/springframework/aot/hint/support/PathMatchingResourcePatternResolverRuntimeHints.java
  7. 8
      spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java
  8. 6
      spring-core/src/main/java/org/springframework/aot/nativex/ResourceHintsWriter.java

5
spring-core/src/main/java/org/springframework/aot/generate/AppendableConsumerInputStreamSource.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.aot.generate;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
@ -42,7 +41,7 @@ class AppendableConsumerInputStreamSource implements InputStreamSource { @@ -42,7 +41,7 @@ class AppendableConsumerInputStreamSource implements InputStreamSource {
@Override
public InputStream getInputStream() throws IOException {
public InputStream getInputStream() {
return new ByteArrayInputStream(toString().getBytes(StandardCharsets.UTF_8));
}

2
spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java

@ -187,7 +187,7 @@ public class BindingReflectionHintsRegistrar { @@ -187,7 +187,7 @@ public class BindingReflectionHintsRegistrar {
.from(element, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY)
.stream(JACKSON_ANNOTATION)
.filter(MergedAnnotation::isMetaPresent)
.forEach(action::accept);
.forEach(action);
}
private void registerHintsForClassAttributes(ReflectionHints hints, MergedAnnotation<Annotation> annotation) {

2
spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java

@ -124,6 +124,6 @@ public enum MemberCategory { @@ -124,6 +124,6 @@ public enum MemberCategory {
* reflection for inner classes but rather makes sure they are available
* via a call to {@link Class#getDeclaredClasses}.
*/
DECLARED_CLASSES;
DECLARED_CLASSES
}

4
spring-core/src/main/java/org/springframework/aot/hint/ResourcePatternHints.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -143,7 +143,7 @@ public final class ResourcePatternHints { @@ -143,7 +143,7 @@ public final class ResourcePatternHints {
* @param excludes the exclude patterns (see {@link ResourcePatternHint} documentation)
* @return {@code this}, to facilitate method chaining
*/
public Builder excludes(TypeReference reachableType, String... excludes) {
public Builder excludes(@Nullable TypeReference reachableType, String... excludes) {
List<ResourcePatternHint> newExcludes = Arrays.stream(excludes)
.map(include -> new ResourcePatternHint(include, reachableType)).toList();
this.excludes.addAll(newExcludes);

3
spring-core/src/main/java/org/springframework/aot/hint/support/KotlinDetectorRuntimeHints.java

@ -19,6 +19,7 @@ package org.springframework.aot.hint.support; @@ -19,6 +19,7 @@ package org.springframework.aot.hint.support;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.lang.Nullable;
/**
* {@link RuntimeHintsRegistrar} to register hints for {@link org.springframework.core.KotlinDetector}.
@ -29,7 +30,7 @@ import org.springframework.aot.hint.TypeReference; @@ -29,7 +30,7 @@ import org.springframework.aot.hint.TypeReference;
class KotlinDetectorRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.reflection().registerType(TypeReference.of("kotlin.Metadata"))
.registerType(TypeReference.of("kotlin.reflect.full.KClasses"));
}

3
spring-core/src/main/java/org/springframework/aot/hint/support/PathMatchingResourcePatternResolverRuntimeHints.java

@ -20,6 +20,7 @@ import org.springframework.aot.hint.RuntimeHints; @@ -20,6 +20,7 @@ import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.lang.Nullable;
/**
* {@link RuntimeHintsRegistrar} for {@link PathMatchingResourcePatternResolver}.
@ -28,7 +29,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver; @@ -28,7 +29,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
class PathMatchingResourcePatternResolverRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.reflection().registerType(TypeReference.of("org.eclipse.core.runtime.FileLocator"));
}
}

8
spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,9 +47,11 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar { @@ -47,9 +47,11 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
ClassLoader classLoaderToUse = (classLoader != null ? classLoader
: SpringFactoriesLoaderRuntimeHints.class.getClassLoader());
for (String resourceLocation : RESOURCE_LOCATIONS) {
registerHints(hints, classLoader, resourceLocation);
registerHints(hints, classLoaderToUse, resourceLocation);
}
}

6
spring-core/src/main/java/org/springframework/aot/nativex/ResourceHintsWriter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -60,8 +60,8 @@ class ResourceHintsWriter { @@ -60,8 +60,8 @@ class ResourceHintsWriter {
return attributes;
}
private void handleResourceBundles(Map<String, Object> attributes, Stream<ResourceBundleHint> ressourceBundles) {
addIfNotEmpty(attributes, "bundles", ressourceBundles.map(this::toAttributes).toList());
private void handleResourceBundles(Map<String, Object> attributes, Stream<ResourceBundleHint> resourceBundles) {
addIfNotEmpty(attributes, "bundles", resourceBundles.map(this::toAttributes).toList());
}
private Map<String, Object> toAttributes(ResourceBundleHint hint) {

Loading…
Cancel
Save