Skip to content

Commit

Permalink
Check if inner class is enclosed by the class it extends
Browse files Browse the repository at this point in the history
  • Loading branch information
tkindy committed Jun 10, 2024
1 parent c98cd59 commit c5cc883
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private void handle(ExpressionTree tree) {
if (!use.isSubClass(classSymbol, state.getTypes())) {
return;
}
if (!isStatic(use)) {
if (use.isEnclosedBy(classSymbol) && !isStatic(use)) {
// Nested inner classes implicitly take the enclosing instance as a constructor parameter,
// and can't be initialized without first initializing their containing class.
return;
Expand Down

0 comments on commit c5cc883

Please sign in to comment.