Skip to content

Commit 26f359b

Browse files
Add javadoc boilerplate internal comment v2 for experimental classes (#6886)
Co-authored-by: Trask Stalnaker <[email protected]>
1 parent 4c30ec4 commit 26f359b

File tree

8 files changed

+34
-19
lines changed

8 files changed

+34
-19
lines changed

custom-checks/src/main/java/io/opentelemetry/gradle/customchecks/OtelInternalJavadoc.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121

2222
@BugPattern(
2323
summary =
24-
"This public internal class doesn't end with the javadoc disclaimer: \""
25-
+ OtelInternalJavadoc.EXPECTED_INTERNAL_COMMENT
24+
"This public internal class doesn't end with any of the applicable javadoc disclaimers: \""
25+
+ OtelInternalJavadoc.EXPECTED_INTERNAL_COMMENT_V1
26+
+ "\", or \""
27+
+ OtelInternalJavadoc.EXPECTED_INTERNAL_COMMENT_V2
2628
+ "\"",
2729
severity = WARNING)
2830
public class OtelInternalJavadoc extends BugChecker implements BugChecker.ClassTreeMatcher {
@@ -31,17 +33,24 @@ public class OtelInternalJavadoc extends BugChecker implements BugChecker.ClassT
3133

3234
private static final Pattern INTERNAL_PACKAGE_PATTERN = Pattern.compile("\\binternal\\b");
3335

34-
static final String EXPECTED_INTERNAL_COMMENT =
36+
static final String EXPECTED_INTERNAL_COMMENT_V1 =
3537
"This class is internal and is hence not for public use."
3638
+ " Its APIs are unstable and can change at any time.";
3739

40+
static final String EXPECTED_INTERNAL_COMMENT_V2 =
41+
"This class is internal and experimental. Its APIs are unstable and can change at any time."
42+
+ " Its APIs (or a version of them) may be promoted to the public stable API in the"
43+
+ " future, but no guarantees are made.";
44+
3845
@Override
3946
public Description matchClass(ClassTree tree, VisitorState state) {
4047
if (!isPublic(tree) || !isInternal(state) || tree.getSimpleName().toString().endsWith("Test")) {
4148
return Description.NO_MATCH;
4249
}
4350
String javadoc = getJavadoc(state);
44-
if (javadoc != null && javadoc.contains(EXPECTED_INTERNAL_COMMENT)) {
51+
if (javadoc != null
52+
&& (javadoc.contains(EXPECTED_INTERNAL_COMMENT_V1)
53+
|| javadoc.contains(EXPECTED_INTERNAL_COMMENT_V2))) {
4554
return Description.NO_MATCH;
4655
}
4756
return describeMatch(tree);

custom-checks/src/test/resources/io/opentelemetry/gradle/customchecks/internal/InternalJavadocPositiveCases.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
package io.opentelemetry.gradle.customchecks.internal;
77

8-
// BUG: Diagnostic contains: doesn't end with the javadoc disclaimer
8+
// BUG: Diagnostic contains: doesn't end with any of the applicable javadoc disclaimers
99
public class InternalJavadocPositiveCases {
1010

11-
// BUG: Diagnostic contains: doesn't end with the javadoc disclaimer
11+
// BUG: Diagnostic contains: doesn't end with any of the applicable javadoc disclaimers
1212
public static class One {}
1313

1414
/** Doesn't have the disclaimer. */
15-
// BUG: Diagnostic contains: doesn't end with the javadoc disclaimer
15+
// BUG: Diagnostic contains: doesn't end with any of the applicable javadoc disclaimers
1616
public static class Two {}
1717
}

sdk/logs/src/main/java/io/opentelemetry/sdk/logs/internal/LoggerConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
/**
1818
* A collection of configuration options which define the behavior of a {@link Logger}.
1919
*
20-
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
21-
* at any time.
20+
* <p>This class is internal and experimental. Its APIs are unstable and can change at any time. Its
21+
* APIs (or a version of them) may be promoted to the public stable API in the future, but no
22+
* guarantees are made.
2223
*
2324
* @see SdkLoggerProviderUtil#setLoggerConfigurator(SdkLoggerProviderBuilder, ScopeConfigurator)
2425
* @see SdkLoggerProviderUtil#addLoggerConfiguratorCondition(SdkLoggerProviderBuilder, Predicate,

sdk/logs/src/main/java/io/opentelemetry/sdk/logs/internal/SdkEventLoggerProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
* <p>Delegates all calls to the configured {@link LoggerProvider}, and its {@link LoggerBuilder}s,
2323
* {@link Logger}s.
2424
*
25-
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
26-
* at any time.
25+
* <p>This class is internal and experimental. Its APIs are unstable and can change at any time. Its
26+
* APIs (or a version of them) may be promoted to the public stable API in the future, but no
27+
* guarantees are made.
2728
*/
2829
public final class SdkEventLoggerProvider implements EventLoggerProvider {
2930

sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/MeterConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
/**
1818
* A collection of configuration options which define the behavior of a {@link Meter}.
1919
*
20-
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
21-
* at any time.
20+
* <p>This class is internal and experimental. Its APIs are unstable and can change at any time. Its
21+
* APIs (or a version of them) may be promoted to the public stable API in the future, but no
22+
* guarantees are made.
2223
*
2324
* @see SdkMeterProviderUtil#setMeterConfigurator(SdkMeterProviderBuilder, ScopeConfigurator)
2425
* @see SdkMeterProviderUtil#addMeterConfiguratorCondition(SdkMeterProviderBuilder, Predicate,

sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/SdkMeterProviderUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
* A collection of methods that allow use of experimental features prior to availability in public
2222
* APIs.
2323
*
24-
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
25-
* at any time.
24+
* <p>This class is internal and experimental. Its APIs are unstable and can change at any time. Its
25+
* APIs (or a version of them) may be promoted to the public stable API in the future, but no
26+
* guarantees are made.
2627
*/
2728
public final class SdkMeterProviderUtil {
2829

sdk/trace/src/main/java/io/opentelemetry/sdk/trace/internal/SdkTracerProviderUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
* A collection of methods that allow use of experimental features prior to availability in public
1717
* APIs.
1818
*
19-
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
20-
* at any time.
19+
* <p>This class is internal and experimental. Its APIs are unstable and can change at any time. Its
20+
* APIs (or a version of them) may be promoted to the public stable API in the future, but no
21+
* guarantees are made.
2122
*/
2223
public final class SdkTracerProviderUtil {
2324

sdk/trace/src/main/java/io/opentelemetry/sdk/trace/internal/TracerConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
/**
1818
* A collection of configuration options which define the behavior of a {@link Tracer}.
1919
*
20-
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
21-
* at any time.
20+
* <p>This class is internal and experimental. Its APIs are unstable and can change at any time. Its
21+
* APIs (or a version of them) may be promoted to the public stable API in the future, but no
22+
* guarantees are made.
2223
*
2324
* @see SdkTracerProviderUtil#setTracerConfigurator(SdkTracerProviderBuilder, ScopeConfigurator)
2425
* @see SdkTracerProviderUtil#addTracerConfiguratorCondition(SdkTracerProviderBuilder, Predicate,

0 commit comments

Comments
 (0)