Stop using the deprecated Label.workspace_name (#317)

Starting with Bazel 7 we should use Label.repo_name instead.

Closes #317

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/317 from EdSchouten:eschouten/20250909-repo-name 8d6a3e327ffbd9339ac5021c4e07d20454b39ea4
PiperOrigin-RevId: 810880486
Change-Id: I147c477448c29f6a421586cded7f4e05b137c480
diff --git a/java/common/rules/java_runtime.bzl b/java/common/rules/java_runtime.bzl
index 4232117..47a9343 100644
--- a/java/common/rules/java_runtime.bzl
+++ b/java/common/rules/java_runtime.bzl
@@ -54,7 +54,7 @@
 )
 
 def _is_main_repo(label):
-    return label.workspace_name == ""
+    return label.repo_name == ""
 
 def _default_java_home(label):
     if _is_main_repo(label):
@@ -70,7 +70,7 @@
     if paths.is_absolute(java_home) or _is_main_repo(label):
         return helper.get_relative(java_home, _get_bin_java(ctx))
     else:
-        repo_runfiles_path = "" if _is_main_repo(label) else helper.get_relative("..", label.workspace_name)
+        repo_runfiles_path = "" if _is_main_repo(label) else helper.get_relative("..", label.repo_name)
         return helper.get_relative(repo_runfiles_path, _get_bin_java(ctx))
 
 def _is_java_binary(path):
diff --git a/java/private/java_common_internal.bzl b/java/private/java_common_internal.bzl
index 54f0c7b..45b4f09 100644
--- a/java/private/java_common_internal.bzl
+++ b/java/private/java_common_internal.bzl
@@ -141,7 +141,7 @@
     if ("com.google.devtools.build.runfiles.AutoBazelRepositoryProcessor" in
         plugin_info.plugins.processor_classes.to_list()):
         all_javac_opts.append(depset(
-            ["-Abazel.repository=" + ctx.label.workspace_name],
+            ["-Abazel.repository=" + ctx.label.repo_name],
             order = "preorder",
         ))
     system_bootclasspath = None