INRIA / INRIA/spoon

bug: NullPointerException in MethodTypingContext

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

Description

The first here line assumes that `typeParam` is never null:
https://github.com/INRIA/spoon/blob/3435facc2b7089119a0ac278a2e008fde7d7c6b7/src/main/java/spoon/support/visitor/MethodTypingContext.java#L173-L177
But the argument (in the last return statement) actually **can** be null because the declaration can be null is some cases:
https://github.com/INRIA/spoon/blob/3435facc2b7089119a0ac278a2e008fde7d7c6b7/src/main/java/spoon/support/visitor/AbstractTypingContext.java#L66-L71

This bug is somewhat related to #3733 and #3734 - it surfaced when I tried fixing the latter by not copying the parent when it doesn't exist. Now adaptTypeParameterReference gets an invalid (?) generic from a corrupted Object type reference because of #3733. This generic doesn't have a declaration and causes the above problem.

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.