From 2b72d11832d06f0ba9d2810564d44eaee5b61c48 Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Tue, 24 Jun 2025 11:20:34 -0300 Subject: [PATCH] Add `NotMultiProjectCapable` annotation Some features are unavailable in serverless and are thus not worth the investment to make fully project-aware. This new annotation can be used to clearly mark blocks of code that are intentionally not made properly project-aware, in case we need to revisit them in the future. --- .../core/NotMultiProjectCapable.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 libs/core/src/main/java/org/elasticsearch/core/NotMultiProjectCapable.java diff --git a/libs/core/src/main/java/org/elasticsearch/core/NotMultiProjectCapable.java b/libs/core/src/main/java/org/elasticsearch/core/NotMultiProjectCapable.java new file mode 100644 index 0000000000000..051ed4eb2c91b --- /dev/null +++ b/libs/core/src/main/java/org/elasticsearch/core/NotMultiProjectCapable.java @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +package org.elasticsearch.core; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to identify a block of code (a whole class, a method, a field, or a local variable) that is intentionally not fully + * project-aware because it's not intended to be used in a serverless environment. Some features are unavailable in serverless and are + * thus not worth the investment to make fully project-aware. This annotation makes it easier to identify blocks of code that require + * attention in case those features are revisited from a multi-project POV. + */ +@Retention(RetentionPolicy.SOURCE) +@Target( + { ElementType.LOCAL_VARIABLE, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.MODULE } +) +public @interface NotMultiProjectCapable { + + /** + * Some explanation on why the block of code would not work in a multi-project context and/or what would need to be done to make it + * properly project-aware. + */ + String description() default ""; +}