Polishing

This commit is contained in:
Sam Brannen 2023-03-05 19:37:11 +01:00
parent 8ebd746d69
commit 56523d5014
19 changed files with 19 additions and 24 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.

View File

@ -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.
@ -16,7 +16,6 @@
package org.springframework.aot.agent;
import org.springframework.aot.hint.JavaSerializationHint;
import org.springframework.aot.hint.JdkProxyHint;
import org.springframework.aot.hint.ReflectionHints;

View File

@ -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.
@ -33,7 +33,6 @@ import java.util.stream.Stream;
import org.springframework.lang.Nullable;
/**
* Instrumented version of JDK methods to be used by bytecode rewritten by the {@link RuntimeHintsAgent}.
* <p>Methods implemented here follow a specific naming pattern "lowercase type name + bridged method name",

View File

@ -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.
@ -176,13 +176,13 @@ public final class RecordedInvocation {
@Override
public String toString() {
if(isStatic()) {
return String.format("<%s> invocation of <%s> with arguments %s",
if (isStatic()) {
return "<%s> invocation of <%s> with arguments %s".formatted(
getHintType().hintClassName(), getMethodReference(), getArguments());
}
else {
Class<?> instanceType = (getInstance() instanceof Class<?>) ? getInstance() : getInstance().getClass();
return String.format("<%s> invocation of <%s> on type <%s> with arguments %s",
return "<%s> invocation of <%s> on type <%s> with arguments %s".formatted(
getHintType().hintClassName(), getMethodReference(), instanceType.getCanonicalName(), getArguments());
}
}

View File

@ -36,11 +36,13 @@ public final class ClassFile {
private final byte[] content;
private ClassFile(String name, byte[] content) {
this.name = name;
this.content = content;
}
/**
* Return the fully qualified name of the class.
* @return the class name

View File

@ -35,6 +35,7 @@ public final class ClassFiles implements Iterable<ClassFile> {
private static final ClassFiles NONE = new ClassFiles(Collections.emptyMap());
private final Map<String, ClassFile> files;
private ClassFiles(Map<String, ClassFile> files) {

View File

@ -45,6 +45,7 @@ final class CompileWithForkedClassLoaderClassLoader extends ClassLoader {
this.testClassLoader = testClassLoader;
}
// Invoked reflectively by DynamicClassLoader
@SuppressWarnings("unused")
void setClassResourceLookup(Function<String, byte[]> classResourceLookup) {

View File

@ -93,7 +93,6 @@ public class DynamicClassLoader extends ClassLoader {
}
private Class<?> defineClass(String name, byte[] bytes) {
if (this.defineClassMethod != null) {
return (Class<?>) ReflectionUtils.invokeMethod(this.defineClassMethod,

View File

@ -32,7 +32,6 @@ import org.springframework.util.Assert;
*/
public abstract sealed class DynamicFile permits SourceFile, ResourceFile {
private final String path;
private final String content;

View File

@ -39,6 +39,7 @@ public class DynamicFileAssert<A extends DynamicFileAssert<A, F>, F extends Dyna
super(actual, selfType);
}
/**
* Verify that the actual content is equal to the given one.
* @param content the expected content of the file

View File

@ -37,7 +37,6 @@ import org.springframework.lang.Nullable;
*/
final class DynamicFiles<F extends DynamicFile> implements Iterable<F> {
private static final DynamicFiles<?> NONE = new DynamicFiles<>(Collections.emptyMap());

View File

@ -63,6 +63,7 @@ class DynamicJavaFileManager extends ForwardingJavaFileManager<JavaFileManager>
this.classLoader = classLoader;
}
@Override
public ClassLoader getClassLoader(Location location) {
return this.classLoader;

View File

@ -33,7 +33,6 @@ import org.springframework.util.FileCopyUtils;
*/
public final class ResourceFile extends DynamicFile implements AssertProvider<ResourceFileAssert> {
private ResourceFile(String path, String content) {
super(path, content);
}

View File

@ -22,13 +22,10 @@ package org.springframework.core.test.tools;
* @author Phillip Webb
* @since 6.0
*/
public class ResourceFileAssert
extends DynamicFileAssert<ResourceFileAssert, ResourceFile> {
public class ResourceFileAssert extends DynamicFileAssert<ResourceFileAssert, ResourceFile> {
ResourceFileAssert(ResourceFile actual) {
super(actual, ResourceFileAssert.class);
}
}

View File

@ -61,6 +61,7 @@ public final class SourceFile extends DynamicFile implements AssertProvider<Sour
this.className = className;
}
/**
* Factory method to create a new {@link SourceFile} by looking up source
* for the given test {@code Class}.
@ -227,6 +228,4 @@ public final class SourceFile extends DynamicFile implements AssertProvider<Sour
return new SourceFileAssert(this);
}
}

View File

@ -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.
@ -24,7 +24,6 @@ package org.springframework.core.test.tools;
*/
public class SourceFileAssert extends DynamicFileAssert<SourceFileAssert, SourceFile> {
SourceFileAssert(SourceFile actual) {
super(actual, SourceFileAssert.class);
}

View File

@ -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.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 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.