@@ -132,12 +132,31 @@ let cache_classname cn =
132132
133133let is_classname_cached cn = Sys. file_exists (path_of_cached_classname cn) = `Yes
134134
135+ let test_source_file_location source_file program cn node =
136+ let is_synthetic = function
137+ | Javalib. JInterface _ ->
138+ false
139+ | Javalib. JClass jc ->
140+ jc.Javalib. c_synthetic
141+ in
142+ if not (is_synthetic node) then
143+ match JClasspath. get_java_location program cn with
144+ | None ->
145+ L. (debug Capture Verbose )
146+ " WARNING SOURCE FILE PARSER: location not found for class %s in source file %s \n "
147+ (JBasics. cn_name cn)
148+ (SourceFile. to_abs_path source_file)
149+ | Some _ ->
150+ ()
151+
152+
135153(* Given a source file and a class, translates the code of this class.
136154 In init - mode, finds out whether this class contains initializers at all,
137155 in this case translates it. In standard mode, all methods are translated *)
138156let create_icfg source_file program tenv icfg cn node =
139157 L. (debug Capture Verbose ) " \t classname: %s@." (JBasics. cn_name cn) ;
140158 if Config. dependency_mode && not (is_classname_cached cn) then cache_classname cn ;
159+ test_source_file_location source_file program cn node ;
141160 let translate m =
142161 let proc_name = JTransType. translate_method_name program tenv m in
143162 JClasspath. set_callee_translated program proc_name ;
@@ -194,19 +213,8 @@ let compute_source_icfg program tenv source_basename package_opt source_file =
194213 let select test procedure cn node =
195214 if test node then try procedure cn node with Bir. Subroutine -> ()
196215 in
197- let set_java_location cn _node =
198- let cn_name = JBasics. cn_name cn in
199- let loc = JSourceFileInfo. class_name_location source_file cn_name in
200- L. debug Capture Verbose " set_java_location %s with location %a@." cn_name Location. pp_file_pos
201- loc ;
202- JClasspath. set_java_location program cn loc
203- in
204216 (* we must set the java location for all classes in the source file before translation *)
205- let () =
206- JBasics.ClassMap. iter
207- (select (should_capture program package_opt source_basename) set_java_location)
208- (JClasspath. get_classmap program)
209- in
217+ JSourceFileInfo. collect_class_location program source_file ;
210218 let () =
211219 JBasics.ClassMap. iter
212220 (select
0 commit comments