Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

StackOverflow in ProtectedAccessAnalyzer.analyze(...) #1323

Closed

Description

@christophstrobl

Inspecting the following structure (extracted from odrotbohm/spring-restbucks) via it's BeanInstanceDescriptor for the jpa repository declaration leads to StackOverflowError on ProtectedAccessAnalyzer.analyze.

@Test
void causesStackOverflow() {

	ProtectedAccessAnalyzer analyzer = new ProtectedAccessAnalyzer(Payments.class.getPackageName());
	ResolvableType type = ResolvableType.forClassWithGenerics(JpaRepositoryFactoryBean.class, ResolvableType.forClass(Payments.class), ResolvableType.forClass(Payment.class), ResolvableType.forClass(Long.class));
	analyzer.analyze(BeanInstanceDescriptor.of(type).build());
}

// Spring Data Repository Declaration
interface Payments extends PagingAndSortingRepository<Payment<?>, Long> {
	Optional<Payment<?>> findByOrder(Object order);
}

// Payment 
public abstract class Payment<T extends AggregateRoot<T, PaymentIdentifier>> implements AggregateRoot<T, PaymentIdentifier> {
}

static class PaymentIdentifier implements Identifier {
	String id;
}

// from org.jmolecules.ddd
public interface Identifier {}

// from org.jmolecules.ddd
public interface AggregateRoot<T extends AggregateRoot<T, ID>, ID extends Identifier> extends Entity<T, ID> {
}

// from org.jmolecules.ddd
public interface Entity<T extends AggregateRoot<T, ?>, ID> extends Identifiable<ID> {}

// from org.jmolecules.ddd
public interface Identifiable<ID> {
	ID getId();
}

Activity

  1. added
    type: bug
    on Dec 1, 2021
  2. modified the milestones: 0.11.1, 0.11.0 on Dec 1, 2021
  3. snicoll commented on Dec 2, 2021

    @snicoll
    Contributor

    Thanks for the sample!

  4. added a commit that references this issue on Feb 17, 2024
    9d7d551
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions