Skip to content

Autowiring of Generic Types - StackOverflowError ResolvableType.isAssignableFrom(ResolvableType.java:259) [SPR-11522] #16147

@spring-projects-issues

Description

@spring-projects-issues

Dumitru Boldureanu opened SPR-11522 and commented

I'm experiencing what seems to be a spring 4.0 bug related to the new feature "Autowiring of Generic Types".

Getting a java.lang.StackOverflowError when trying to inject a generic dao:

public interface StockMovementDao<S extends StockMovement>

the important is in the following two lines:

public interface StockMovement<P extends StockMovementInstruction>
public interface StockMovementInstruction<C extends StockMovement>

Please note that one uses the other as generic parameter - StockMovement uses StockMovementInstruction and StockMovementInstruction the StockMovement.

Because of that org.springframework.core.ResolvableType.isAssignableFrom(ResolvableType.java:259) is called for one then for the other infinitely till a StackOverflowError.

I guess that to fix this bug, A.isAssignableFrom(B) -> B.isAssignableFrom(A) cases should be detected. I might be wrong, but in these cases it should probably return true.


Affects: 4.0 GA, 4.0.1, 4.0.2

Attachments:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions