@@ -163,14 +163,16 @@ def _test_compile_extend_compile_time_jdeps_rule_outputs_impl(env, targets):
163163 ])
164164
165165def _test_compile_bootclasspath (name ):
166+ files = [
167+ "custom-system/lib/jrt-fs.jar" ,
168+ "custom-system/lib/modules" ,
169+ "custom-system/release" ,
170+ ]
166171 util .helper_target (
167172 custom_bootclasspath ,
168173 name = name + "/bootclasspath" ,
169- srcs = [
170- "custom-system/lib/jrt-fs.jar" ,
171- "custom-system/lib/modules" ,
172- "custom-system/release" ,
173- ],
174+ bootclasspath = files ,
175+ system = files ,
174176 )
175177 util .helper_target (
176178 custom_library_with_bootclasspath ,
@@ -197,6 +199,39 @@ def _test_compile_bootclasspath_impl(env, target):
197199 "{}/custom-system" .format (target .label .package ),
198200 )])
199201
202+ def _test_compile_override_with_empty_bootclasspath (name ):
203+ util .helper_target (
204+ custom_bootclasspath ,
205+ name = name + "/bootclasspath" ,
206+ bootclasspath = [],
207+ system = [
208+ "custom-system/lib/jrt-fs.jar" ,
209+ "custom-system/lib/modules" ,
210+ "custom-system/release" ,
211+ ],
212+ )
213+ util .helper_target (
214+ custom_library_with_bootclasspath ,
215+ name = name + "/custom" ,
216+ srcs = ["Main.java" ],
217+ bootclasspath = name + "/bootclasspath" ,
218+ )
219+
220+ analysis_test (
221+ name = name ,
222+ impl = _test_compile_override_with_empty_bootclasspath_impl ,
223+ target = name + "/custom" ,
224+ attr_values = {"tags" : ["min_bazel_7" ]},
225+ )
226+
227+ def _test_compile_override_with_empty_bootclasspath_impl (env , target ):
228+ assert_that_javac = env .expect .that_target (target ).action_named ("Javac" )
229+
230+ assert_that_javac .contains_flag_values ([(
231+ "--system" ,
232+ "{}/custom-system" .format (target .label .package ),
233+ )])
234+
200235def java_common_tests (name ):
201236 test_suite (
202237 name = name ,
@@ -208,5 +243,6 @@ def java_common_tests(name):
208243 _test_compile_extend_compile_time_jdeps ,
209244 _test_compile_extend_compile_time_jdeps_rule_outputs ,
210245 _test_compile_bootclasspath ,
246+ _test_compile_override_with_empty_bootclasspath ,
211247 ],
212248 )
0 commit comments