Skip to content

Commit 62b5423

Browse files
bcorsoDagger Team
authored andcommitted
Internal changes
RELNOTES=N/A PiperOrigin-RevId: 863410555
1 parent 8dcce87 commit 62b5423

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

MODULE.bazel

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ INCAP_VERSION = "0.2"
5050

5151
KOTLIN_VERSION = "2.2.20"
5252

53+
KOTLINPOET_VERSION = "1.11.0"
54+
5355
KSP_VERSION = KOTLIN_VERSION + "-2.0.3"
5456

5557
MAVEN_VERSION = "3.3.3"
@@ -141,8 +143,8 @@ maven.install(
141143
"com.google.guava:guava-beta-checker:1.0",
142144
"com.google.protobuf:protobuf-java:4.32.1",
143145
"com.squareup:javapoet:1.13.0",
144-
"com.squareup:kotlinpoet:1.11.0",
145-
"com.squareup:kotlinpoet-javapoet:1.11.0",
146+
"com.squareup:kotlinpoet:%s" % KOTLINPOET_VERSION,
147+
"com.squareup:kotlinpoet-javapoet:%s" % KOTLINPOET_VERSION,
146148
"io.github.java-diff-utils:java-diff-utils:4.11",
147149
"io.grpc:grpc-context:%s" % GRPC_VERSION,
148150
"io.grpc:grpc-core:%s" % GRPC_VERSION,

dagger-compiler/main/java/dagger/internal/codegen/xprocessing/XAnnotationSpecs.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,24 @@
4141

4242
/** Static factories to create {@link AnnotationSpec}s. */
4343
public final class XAnnotationSpecs {
44+
public static XAnnotationSpec of(XClassName className) {
45+
return builder(className).build();
46+
}
47+
4448
public static XAnnotationSpec of(XAnnotation annotation) {
49+
return of(annotation, /* includeDefaultValues= */ false);
50+
}
51+
52+
public static XAnnotationSpec of(XAnnotation annotation, boolean includeDefaultValues) {
4553
return toXPoet(
46-
JavaPoetExtKt.toAnnotationSpec(annotation, /* includeDefaultValues= */ false),
54+
JavaPoetExtKt.toAnnotationSpec(annotation, includeDefaultValues),
4755
// TODO(b/411661393): Add support for annotation values. For now, the KotlinPoet
4856
// implementation only copies the class name and ignores the annotation values.
4957
com.squareup.kotlinpoet.AnnotationSpec
5058
.builder(toKotlinPoet(XAnnotations.asClassName(annotation)))
5159
.build());
5260
}
5361

54-
public static XAnnotationSpec of(XClassName className) {
55-
return builder(className).build();
56-
}
57-
5862
/** Values for an {@link SuppressWarnings} annotation. */
5963
public enum Suppression {
6064
RAWTYPES("rawtypes"),

gradle/libs.versions.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ junit = "4.13"
1515
jvmTarget = "1.8"
1616
kotlin = "2.2.20"
1717
kotlinTarget = "1.9"
18+
kotlinPoet = "1.11.0"
1819
ksp = "2.2.20-2.0.3"
1920
publish = "0.30.0"
2021
shadow = "8.3.5"
@@ -64,8 +65,8 @@ kotlin-compilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-emb
6465
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
6566
kotlin-metadataJvm = { module = "org.jetbrains.kotlin:kotlin-metadata-jvm", version.ref = "kotlin" }
6667
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
67-
kotlinPoet = { module = "com.squareup:kotlinpoet", version = "1.11.0" }
68-
kotlinPoet-javaPoet = { module = "com.squareup:kotlinpoet-javapoet", version = "1.11.0" }
68+
kotlinPoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinPoet" }
69+
kotlinPoet-javaPoet = { module = "com.squareup:kotlinpoet-javapoet", version.ref = "kotlinPoet" }
6970
ksp = { module = "com.google.devtools.ksp:symbol-processing", version.ref = "ksp" }
7071
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
7172
ksp-common = { module = "com.google.devtools.ksp:symbol-processing-common-deps", version.ref = "ksp" }

0 commit comments

Comments
 (0)