@@ -166,8 +166,8 @@ def _map_jvm_to_class_resource(
166166):
167167 """
168168 Map the ``to_resource`` .class file Resource with a Resource in
169- ``from_resources`` .java files, using the ``from_classes_index`` index of
170- from/ fully qualified Java class names .
169+ ``from_resources`` source files, using the ``from_classes_index`` index of
170+ from/ fully qualified binary files .
171171 """
172172 for extension in jvm_lang .source_extensions :
173173 normalized_path = jvm_lang .get_normalized_path (
@@ -194,23 +194,26 @@ def _map_jvm_to_class_resource(
194194
195195def map_jvm_to_class (project , jvm_lang : jvm .JvmLanguage , logger = None ):
196196 """
197- Map to/ compiled Java .class(es) to from/ .java source using Java fully
198- qualified paths and indexing from/ .java files.
197+ Map to/ compiled Jvm's binary files to from/ using Jvm language's fully
198+ qualified paths and indexing from/ Jvm lang's source files.
199199 """
200200 project_files = project .codebaseresources .files ().no_status ()
201201 from_resources = project_files .from_codebase ()
202202 to_resources = project_files .to_codebase ().has_no_relation ()
203203
204- filter = {f"extra_data__{ jvm_lang .source_package_attribute_name } __isnull" : False }
204+ has_source_pkg_attr_name = {
205+ f"extra_data__{ jvm_lang .source_package_attribute_name } __isnull" : False
206+ }
205207
206208 to_resources_binary_extension = to_resources .filter (
207209 extension__in = jvm_lang .binary_extensions
208210 )
209211 from_resources_source_extension = (
210212 from_resources .filter (extension__in = jvm_lang .source_extensions )
211- # The "java_package" extra_data value is set during the `find_java_packages`,
213+ # The source_package_attribute_name extra_data value
214+ # is set during the `find_jvm_package`,
212215 # it is required to build the index.
213- .filter (** filter )
216+ .filter (** has_source_pkg_attr_name )
214217 )
215218 to_resource_count = to_resources_binary_extension .count ()
216219 from_resource_count = from_resources_source_extension .count ()
@@ -225,8 +228,8 @@ def map_jvm_to_class(project, jvm_lang: jvm.JvmLanguage, logger=None):
225228 f"{ from_resource_count :,d} { jvm_lang .source_extensions } "
226229 )
227230
228- # build an index using from-side Java fully qualified class file names
229- # built from the "java_package" and file name
231+ # build an index using from-side fully qualified class file names
232+ # built from the source_package_attribute_name and file name
230233 indexables = jvm_lang .get_indexable_qualified_paths (from_resources_source_extension )
231234
232235 # we do not index subpath since we want to match only fully qualified names
@@ -237,13 +240,16 @@ def map_jvm_to_class(project, jvm_lang: jvm.JvmLanguage, logger=None):
237240
238241 for to_resource in progress .iter (resource_iterator ):
239242 _map_jvm_to_class_resource (
240- to_resource , from_resources , from_classes_index , jvm_lang
243+ to_resource = to_resource ,
244+ from_resources = from_resources ,
245+ from_classes_index = from_classes_index ,
246+ jvm_lang = jvm_lang ,
241247 )
242248
243249
244250def find_jvm_packages (project , jvm_lang : jvm .JvmLanguage , logger = None ):
245251 """
246- Collect the JVM packages of Java source files for a ``project``.
252+ Collect the JVM packages of source files for a ``project``.
247253
248254 Multiprocessing is enabled by default on this pipe, the number of processes
249255 can be controlled through the SCANCODEIO_PROCESSES setting.
@@ -272,7 +278,7 @@ def find_jvm_packages(project, jvm_lang: jvm.JvmLanguage, logger=None):
272278
273279def save_jvm_package_scan_results (codebase_resource , scan_results , scan_errors ):
274280 """
275- Save the resource Java package scan results in the database as Resource.extra_data.
281+ Save the resource Jvm package scan results in the database as Resource.extra_data.
276282 Create project errors if any occurred during the scan.
277283 """
278284 # The status is only updated in case of errors.
@@ -309,16 +315,16 @@ def _map_jar_to_jvm_source_resource(
309315 dot_class_file_ids = [
310316 dot_class_file .get ("id" ) for dot_class_file in jar_extracted_dot_class_files
311317 ]
312- java_to_class_extra_data_list = CodebaseRelation .objects .filter (
318+ jvm_binary_map_type_extra_data_list = CodebaseRelation .objects .filter (
313319 to_resource__in = dot_class_file_ids , map_type = jvm_lang .binary_map_type
314320 ).values_list ("extra_data" , flat = True )
315321
316322 from_source_roots = [
317323 extra_data .get ("from_source_root" , "" )
318- for extra_data in java_to_class_extra_data_list
324+ for extra_data in jvm_binary_map_type_extra_data_list
319325 ]
320326 if len (set (from_source_roots )) != 1 :
321- # Could not determine a common root directory for the java_to_class files
327+ # Could not determine a common root directory for the binary_map_type files
322328 return
323329
324330 common_source_root = from_source_roots [0 ].rstrip ("/" )
0 commit comments