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

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

Closed
christophstrobl opened this issue Dec 1, 2021 · 1 comment
Closed

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

christophstrobl opened this issue Dec 1, 2021 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@christophstrobl
Copy link
Contributor

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();
}
@snicoll snicoll added the type: bug A general bug label Dec 1, 2021
@snicoll snicoll modified the milestones: 0.11.1, 0.11.0 Dec 1, 2021
@snicoll snicoll closed this as completed in 9d7d551 Dec 2, 2021
@snicoll
Copy link
Contributor

snicoll commented Dec 2, 2021

Thanks for the sample!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A general bug
Development

No branches or pull requests

2 participants