INRIA / INRIA/spoon

bug: ParentNotInitializedException in AbstractTypingContext#adaptType()

Open
#3,734 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

[This line](https://github.com/INRIA/spoon/blob/7abce70c8b5742f5e2f1bc59151871dd1d2050c6/src/main/java/spoon/support/visitor/AbstractTypingContext.java#L49) throws an exception when the `result` is a CtTypeReference without a parent, but with type parameters. And "standard" types from a `TypeFactory` don't have parents.

It's also kinda connected to #3733:
1. Type reference for `java.lang.Object` gets corrupted with type parameters
2. `getBound()` returns the corrupted type reference for `java.lang.Object` [here](https://github.com/INRIA/spoon/blob/7abce70c8b5742f5e2f1bc59151871dd1d2050c6/src/main/java/spoon/support/visitor/MethodTypingContext.java#L244)
3. The corrupted type reference destroys `adaptType()` because it doesn't have a parent as a "standard" type in a `TypeFactory`

I haven't managed to make a minimal reproducible sample and can't share the main code, sorry.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.