Skip to content

Commit

Permalink
Fix capture conversion in lenient mode.
Browse files Browse the repository at this point in the history
...by always performing capture conversion in _strict_ mode, where there
is a better-defined hierarchy (non-null < unspecified < nullable, with
no "but also unspecified < non-null if you want).

Fixes jspecify#193
  • Loading branch information
cpovirk committed Aug 8, 2024
1 parent 3c80e50 commit f6c4d03
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,14 @@ public boolean isParametricQualifier(AnnotationMirror qualifier) {
}
}

@Override
public AnnotatedTypeMirror applyCaptureConversion(
AnnotatedTypeMirror type, TypeMirror typeMirror) {
return this == withLeastConvenientWorld
? super.applyCaptureConversion(type, typeMirror)
: withLeastConvenientWorld.applyCaptureConversion(type, typeMirror);
}

@Override
protected TypeHierarchy createTypeHierarchy() {
return new NullSpecTypeHierarchy(
Expand Down

0 comments on commit f6c4d03

Please sign in to comment.