Repository navigation
Add purity annotations #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f47614d
27774d5
0f6c584
816a214
0a47152
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -25,6 +25,8 @@ | |||
|
|
||||
| package javax.lang.model.util; | ||||
|
|
||||
| import org.checkerframework.dataflow.qual.SideEffectFree; | ||||
|
|
||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import java.util.Set; | ||||
|
|
@@ -145,6 +147,7 @@ private ElementFilter() {} // Do not instantiate. | |||
| * {@return a list of methods in {@code elements}} | ||||
| * @param elements the elements to filter | ||||
| */ | ||||
| @SideEffectFree | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Remove
Proposed fix- `@SideEffectFree`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||
| public static List<ExecutableElement> | ||||
| methodsIn(Iterable<? extends Element> elements) { | ||||
| return listFilter(elements, METHOD_KIND, ExecutableElement.class); | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Include the wrapped
Readerin each effect summary.@SideEffectsOnly("this")omits the distinct object held inthis.in. These methods read from or close that object, so consumers can treat the wrappedReaderas unchanged. TheSideEffectsOnlydeclaration defines its value as an upper bound on expressions a method might change.src/java.base/share/classes/java/io/BufferedReader.java#L453-L453: Addthis.inalongsidethisbecausereadLine()consumes the wrapped reader.src/java.base/share/classes/java/io/BufferedReader.java#L637-L637: Addthis.inalongsidethisbecauseclose()closes the wrapped reader.src/java.base/share/classes/java/io/LineNumberReader.java#L261-L261: Addthis.inalongsidethisbecausereadLine()delegates toBufferedReaderand consumes the wrapped reader.📍 Affects 2 files
src/java.base/share/classes/java/io/BufferedReader.java#L453-L453(this comment)src/java.base/share/classes/java/io/BufferedReader.java#L637-L637src/java.base/share/classes/java/io/LineNumberReader.java#L261-L261🤖 Prompt for AI Agents