make/common/JavaCompilation.gmk
changeset 54380 e297c7bb6469
parent 52804 28094715ae71
child 58549 9d9317fad3fe
--- a/make/common/JavaCompilation.gmk	Tue Apr 02 11:37:11 2019 +0200
+++ b/make/common/JavaCompilation.gmk	Tue Oct 24 10:41:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -222,13 +222,12 @@
     ) \
   )
   $$(call MakeDir,$$($1_BIN))
-  # Add all source roots to the find cache since we are likely going to run find
-  # on these more than once. The cache will only be updated if necessary.
-  $$(eval $$(call FillCacheFind, $$($1_SRC)))
-  # Find all files in the source trees. Preserve order of source roots so that
-  # the first version in case of multiple instances of the same file is selected.
-  # CacheFind does not preserve order so need to call it for each root.
-  $1_ALL_SRCS += $$($1_EXTRA_FILES) $$(foreach s, $$($1_SRC), $$(call CacheFind, $$s))
+  # Order src files according to the order of the src dirs. Correct odering is
+  # needed for correct overriding between different source roots.
+  $1_ALL_SRC_RAW := $$(call FindFiles, $$($1_SRC))
+  $1_ALL_SRCS := $$($1_EXTRA_FILES) \
+      $$(foreach d, $$($1_SRC), $$(filter $$d%, $$($1_ALL_SRC_RAW)))
+
   # Extract the java files.
   $1_SRCS := $$(filter %.java, $$($1_ALL_SRCS))