Skip to content

Adapt FieldHint to recent GraalVM versions #29130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 0 additions & 144 deletions spring-core/src/main/java/org/springframework/aot/hint/FieldHint.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class TypeHint implements ConditionalHint {
@Nullable
private final TypeReference reachableType;

private final Set<FieldHint> fields;
private final Set<String> fields;

private final Set<ExecutableHint> constructors;

Expand All @@ -57,7 +57,7 @@ private TypeHint(Builder builder) {
this.type = builder.type;
this.reachableType = builder.reachableType;
this.memberCategories = Set.copyOf(builder.memberCategories);
this.fields = builder.fields.values().stream().map(FieldHint.Builder::build).collect(Collectors.toSet());
this.fields = builder.fields;
this.constructors = builder.constructors.values().stream().map(ExecutableHint.Builder::build).collect(Collectors.toSet());
this.methods = builder.methods.values().stream().map(ExecutableHint.Builder::build).collect(Collectors.toSet());
}
Expand Down Expand Up @@ -89,10 +89,10 @@ public TypeReference getReachableType() {

/**
* Return the fields that require reflection.
* @return a stream of {@link FieldHint}
* @return a stream of Strings
*/
public Stream<FieldHint> fields() {
return this.fields.stream();
public Set<String> fields() {
return this.fields;
}

/**
Expand Down Expand Up @@ -147,7 +147,7 @@ public static class Builder {
@Nullable
private TypeReference reachableType;

private final Map<String, FieldHint.Builder> fields = new HashMap<>();
private final Set<String> fields = new HashSet<>();

private final Map<ExecutableKey, ExecutableHint.Builder> constructors = new HashMap<>();

Expand Down Expand Up @@ -191,31 +191,9 @@ public Builder onReachableType(Class<?> reachableType) {
* @return {@code this}, to facilitate method chaining
*/
public Builder withField(String name) {
return withField(name, FieldMode.WRITE);
return withField(name);
}

/**
* Register the need for reflection on the field with the specified name
* using the specified {@link FieldMode}.
* @param name the name of the field
* @param mode the requested mode
* @return {@code this}, to facilitate method chaining
*/
public Builder withField(String name, FieldMode mode) {
return withField(name, FieldHint.builtWith(mode));
}

/**
* Register the need for reflection on the field with the specified name.
* @param name the name of the field
* @param fieldHint a builder to further customize the hints of this field
* @return {@code this}, to facilitate method chaining
*/
public Builder withField(String name, Consumer<FieldHint.Builder> fieldHint) {
FieldHint.Builder builder = this.fields.computeIfAbsent(name, FieldHint.Builder::new);
fieldHint.accept(builder);
return this;
}

/**
* Register the need for reflection on the constructor with the specified
Expand Down