-
Notifications
You must be signed in to change notification settings - Fork 437
Add @DoesNotUnrefineReceiver annotation
#7640
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
Changes from 15 commits
71c81e7
b49b571
417bc1a
3dc8d87
8bd3880
4e788d5
0c665a5
be6d64a
a4994ad
ace58f0
612220a
45c19f9
99dfc2f
27cc075
0425a81
ec45388
01c42c7
45190a1
2450365
69f2602
f4b10cb
07b6b69
54f251a
1db2897
6b1fa23
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||
| package org.checkerframework.framework.qual; | ||||||
|
|
||||||
| import java.lang.annotation.Documented; | ||||||
| import java.lang.annotation.ElementType; | ||||||
| import java.lang.annotation.Retention; | ||||||
| import java.lang.annotation.RetentionPolicy; | ||||||
| import java.lang.annotation.Target; | ||||||
|
|
||||||
| /** | ||||||
| * At a call to a side-effecting method, the framework ordinarily discards all refined type | ||||||
| * information, since the side-effecting method might invalidate that information. This annotation | ||||||
| * indicates that, at a call to the annotated method, the receiver's type should not be unrefined. | ||||||
| * That is, a call to the method does not affect the type qualifier (in the given hierarchy). | ||||||
| * | ||||||
| * @checker_framework.manual #type-refinement-purity Side effects, determinism, purity, and | ||||||
| * flow-sensitive analysis | ||||||
| */ | ||||||
| // @InheritedAnnotation cannot be written here, because "dataflow" project cannot depend on | ||||||
| // "framework" project. | ||||||
| @Documented | ||||||
| @Retention(RetentionPolicy.RUNTIME) | ||||||
| @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) | ||||||
|
Contributor
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
# Verify all call sites of the new API.
rg -n -C3 '\bhasDoesNotUnrefineReceiver\s*\('
# Look for constructor/object-creation flow paths that might need to honor the annotation.
rg -n -C4 '\b(ObjectCreationNode|ConstructorInvocationNode|visitObjectCreation|updateForMethodCall)\b'Repository: typetools/checker-framework Length of output: 50383 Remove Line 21 allows this annotation on constructors, but verification shows Fix if constructors are not intended to be supported-@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Target(ElementType.METHOD)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| public @interface DoesNotUnrefineReceiver { | ||||||
| /** | ||||||
| * The name of the checker(s) that this annotation affects. For example, "modifiability" or | ||||||
| * "nullness". Use "allcheckers" to affect all checkers. | ||||||
| * | ||||||
| * @return the name of the checker that this annotation affects | ||||||
| */ | ||||||
|
mernst marked this conversation as resolved.
|
||||||
| String[] value(); | ||||||
| } | ||||||
Uh oh!
There was an error while loading. Please reload this page.