-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consistently set target type in generated code
Previously, a bean definition that is optimized AOT could have different metadata based on whether its resolved type had a generic or not. This is due to RootBeanDefinition taking either a Class or a ResolvableType doing fundamentally different things. While the former sets the bean class which is to little use with an instance supplier, the latter specifies the target type of the bean. This commit sets the target type of the bean, using the existing setter methods that take either a class or a ResolvableType and set the same attribute consistently. Closes gh-30689
- Loading branch information
Showing
4 changed files
with
180 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...tFixtures/java/org/springframework/beans/testfixture/beans/factory/aot/TestHierarchy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.beans.testfixture.beans.factory.aot; | ||
|
||
/** | ||
* A hierarchy where the exposed type of a bean is a partial signature. | ||
* | ||
* @author Stephane Nicoll | ||
*/ | ||
public class TestHierarchy { | ||
|
||
public interface One { | ||
} | ||
|
||
public interface Two { | ||
} | ||
|
||
public static class Implementation implements One, Two { | ||
} | ||
|
||
public static One oneBean() { | ||
return new Implementation(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters