From 381c73b89d7f898d08bd0dbc547838f8828450ca Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 4 Nov 2024 22:05:59 +0100 Subject: [PATCH] Add https://github.com/bazelbuild/bazel/pull/24161 --- .../build/runfiles/AutoBazelRepositoryProcessor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/runfiles/src/main/java/com/google/devtools/build/runfiles/AutoBazelRepositoryProcessor.java b/java/runfiles/src/main/java/com/google/devtools/build/runfiles/AutoBazelRepositoryProcessor.java index 17f9dba..2b0ce9d 100644 --- a/java/runfiles/src/main/java/com/google/devtools/build/runfiles/AutoBazelRepositoryProcessor.java +++ b/java/runfiles/src/main/java/com/google/devtools/build/runfiles/AutoBazelRepositoryProcessor.java @@ -95,7 +95,10 @@ private void emitClass(TypeElement annotatedClass) { try (PrintWriter out = new PrintWriter( processingEnv.getFiler().createSourceFile(generatedClassName).openWriter())) { - out.printf("package %s;\n", generatedClassPackage); + if (!generatedClassPackage.isEmpty()) { + // This annotation may exist on a class which is at the root package + out.printf("package %s;\n", generatedClassPackage); + } out.printf("\n"); out.printf("class %s {\n", generatedClassSimpleName); out.printf(" /**\n");