Use enclosing class constructor parameter only for non-static inner classes.

Closes #3038
Original pull request: #3039
This commit is contained in:
Christoph Strobl
2024-02-07 12:32:43 +01:00
committed by Mark Paluch
parent 25f87d251a
commit d333dc612b
2 changed files with 88 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ import org.springframework.data.util.Lazy;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
/**
@@ -31,6 +32,7 @@ import org.springframework.util.StringUtils;
*
* @param <T> the type of the parameter
* @author Oliver Gierke
* @author Christoph Strobl
*/
public class Parameter<T, P extends PersistentProperty<P>> {
@@ -72,7 +74,7 @@ public class Parameter<T, P extends PersistentProperty<P>> {
}
Class<T> owningType = entity.getType();
return owningType.isMemberClass() && type.getType().equals(owningType.getEnclosingClass());
return ClassUtils.isInnerClass(owningType) && type.getType().equals(owningType.getEnclosingClass());
});
this.hasSpelExpression = Lazy.of(() -> StringUtils.hasText(getSpelExpression()));