-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect handling of temporary variable enclosing element in RL …
…inference; fixes #6473
- Loading branch information
1 parent
a49161a
commit 7743e5d
Showing
5 changed files
with
71 additions
and
23 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
26 changes: 26 additions & 0 deletions
26
checker/tests/ainfer-resourceleak/non-annotated/CrashForTempVar.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,26 @@ | ||
/** | ||
* Demonstrates an issue in the Checker Framework with handling the nearest enclosing element for | ||
* temporary variable declarations, leading to a crash during analysis. | ||
*/ | ||
public abstract class CrashForTempVar<T extends Number> { | ||
|
||
private final CrashForTempVar<T> _base; | ||
|
||
protected CrashForTempVar(final CrashForTempVar<T> base) { | ||
_base = base; | ||
} | ||
|
||
public T getValue() { | ||
return _base.getValue(); | ||
} | ||
|
||
protected CrashForTempVar<T> getBase() { | ||
return _base; | ||
} | ||
|
||
protected abstract boolean evaluateLayer(final T baseValue, final T testValue); | ||
|
||
public boolean evaluate(final T testValue) { | ||
return evaluateLayer(getBase().getValue(), testValue); | ||
} | ||
} |
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