Skip to content

Commit 4ef7e11

Browse files
dougqhclaude
andcommitted
Move StaticLifetime/Singleton into datadog.perfcontract and meta-annotate with @PerfContract
Relocates both annotations out of the legacy datadog.trace.api.function package into the new datadog.perfcontract package (introduced by #12647), alongside PerfContract/SuppressPerfContract, and adds @PerfContract so tooling can discover them as perf-contract markers the same way it already discovers Strategy/StrategyConsumer/NoEscape. No other code references either annotation, so no import-site updates are needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 9f80d9c commit 4ef7e11

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

internal-api/src/main/java/datadog/trace/api/function/Singleton.java renamed to internal-api/src/main/java/datadog/perfcontract/Singleton.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package datadog.trace.api.function;
1+
package datadog.perfcontract;
22

33
import java.lang.annotation.Documented;
44
import java.lang.annotation.ElementType;
@@ -21,8 +21,8 @@
2121
* <p>This is a documentation-and-tooling marker; it changes no behavior.
2222
*
2323
* <p><b>v1 posture: trusted declaration, not independently verified.</b> This is the same stance
24-
* the other perf-contract annotations take toward {@code static final} itself -- declared, not
25-
* proven. Verifying it for real (a single construction site, or an instance reachable only via one
24+
* the other perf-contract markers take toward {@code static final} itself -- declared, not proven.
25+
* Verifying it for real (a single construction site, or an instance reachable only via one
2626
* static/DI-registered path) is a call-site/construction-graph problem, out of scope for v1.
2727
* Annotating a class that is, in fact, constructed more than once defeats every guarantee
2828
* downstream checks (starting with {@link StaticLifetime}) build on top of this annotation -- apply
@@ -39,6 +39,7 @@
3939
* annotation. See {@link StaticLifetime}'s own Checker contract section for the full rule.
4040
*/
4141
@Documented
42+
@PerfContract
4243
@Retention(RetentionPolicy.CLASS)
4344
@Target(ElementType.TYPE)
4445
public @interface Singleton {}

internal-api/src/main/java/datadog/trace/api/function/StaticLifetime.java renamed to internal-api/src/main/java/datadog/perfcontract/StaticLifetime.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package datadog.trace.api.function;
1+
package datadog.perfcontract;
22

33
import java.lang.annotation.Documented;
44
import java.lang.annotation.ElementType;
@@ -25,7 +25,7 @@
2525
* object, instead of once as a {@code static} field -- so the cache was allocated and thrown away
2626
* on every request and never actually amortized anything. It compiled, ran, and passed tests while
2727
* quietly defeating the entire point of caching -- the same silent-failure shape as the other
28-
* perf-contract annotations in this package.
28+
* perf-contract markers.
2929
*
3030
* <p>This is a documentation-and-tooling marker; it changes no behavior. It exists to telegraph the
3131
* constraint to readers and to give a future checker something to verify. The discipline it names
@@ -78,6 +78,7 @@
7878
* </ul>
7979
*/
8080
@Documented
81+
@PerfContract
8182
@Retention(RetentionPolicy.CLASS)
8283
@Target(ElementType.FIELD)
8384
public @interface StaticLifetime {}

0 commit comments

Comments
 (0)