-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WPI: decision on whether to infer a type for a type variable should b…
…e made based on explicit annotations (#5618) --------- Co-authored-by: Suzanne Millstein <[email protected]> Co-authored-by: Michael Ernst <[email protected]>
- Loading branch information
1 parent
eebbbf0
commit e84e29e
Showing
6 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...-files/TypeVarReturnAnnotated-org.checkerframework.checker.nullness.NullnessChecker.ajava
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Code like this caused WPI to loop infinitely, because the annotation on the return type | ||
// was only sometimes inferred. Based on an example from | ||
// https://github.com/dd482IT/cache2k-wpi/blob/0eaa156bdecd617b2aa4c745d0f8844a32609697/cache2k-api/src/main/java/org/cache2k/config/ToggleFeature.java#L73 | ||
@org.checkerframework.framework.qual.AnnotatedFor("org.checkerframework.checker.nullness.NullnessChecker") | ||
public class TypeVarReturnAnnotated { | ||
|
||
public static <T extends TypeVarReturnAnnotated> @org.checkerframework.checker.initialization.qual.FBCBottom @org.checkerframework.checker.nullness.qual.Nullable T extract() { | ||
return null; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
checker/tests/ainfer-nullness/non-annotated/TypeVarReturnAnnotated.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Code like this caused WPI to loop infinitely, because the annotation on the return type | ||
// was only sometimes inferred. Based on an example from | ||
// https://github.com/dd482IT/cache2k-wpi/blob/0eaa156bdecd617b2aa4c745d0f8844a32609697/cache2k-api/src/main/java/org/cache2k/config/ToggleFeature.java#L73 | ||
|
||
public class TypeVarReturnAnnotated { | ||
public static <T extends TypeVarReturnAnnotated> T extract() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters