From 0abc85c35243010a2283575a8c4fd1782dc494c6 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Mon, 2 Mar 2020 08:17:58 -0800 Subject: [PATCH] [java] move "$Lambda$" string to Config.ml Summary: Simple cleanup. Reviewed By: ngorogiannis Differential Revision: D19973284 fbshipit-source-id: b71503285 --- infer/src/backend/preanal.ml | 2 +- infer/src/base/Config.ml | 2 ++ infer/src/base/Config.mli | 3 +++ infer/src/java/jClasspath.ml | 5 +---- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/infer/src/backend/preanal.ml b/infer/src/backend/preanal.ml index cfacdee75..165426340 100644 --- a/infer/src/backend/preanal.ml +++ b/infer/src/backend/preanal.ml @@ -104,7 +104,7 @@ module InlineJavaSyntheticMethods = struct let process pdesc = let is_generated_for_lambda proc_name = - String.is_substring ~substring:"$Lambda$" (Procname.get_method proc_name) + String.is_substring ~substring:Config.java_lambda_marker_infix (Procname.get_method proc_name) in let should_inline proc_name = (not (is_generated_for_lambda proc_name)) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 1f6f0b34f..a2dbd4e25 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -198,6 +198,8 @@ let infer_py_argparse_error_exit_code = 22 let ivar_attributes = "ivar_attributes" +let java_lambda_marker_infix = "$Lambda$" + let lint_dotty_dir_name = "lint_dotty" let lint_issues_dir_name = "lint_issues" diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 637adeb5e..a60d40318 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -99,6 +99,9 @@ val initial_analysis_time : float val ivar_attributes : string +val java_lambda_marker_infix : string +(** marker to recognize methods generated by javalib to eliminate lambdas *) + val lib_dir : string val lint_dotty_dir_name : string diff --git a/infer/src/java/jClasspath.ml b/infer/src/java/jClasspath.ml index 3d5bf326c..7c0ba4940 100644 --- a/infer/src/java/jClasspath.ml +++ b/infer/src/java/jClasspath.ml @@ -255,12 +255,9 @@ let get_classpath_channel program = program.classpath.channel let get_models program = program.models -(* this string should characterize the methods we generate for lambda rewriting *) -let lambda_str = "$Lambda$" - let add_class cn jclass program = (* [prefix] must be a fresh class name *) - let prefix = JBasics.cn_name cn ^ lambda_str in + let prefix = JBasics.cn_name cn ^ Config.java_lambda_marker_infix in (* we rewrite each class to replace invokedynamic (closure construction) with equivalent old-style Java code that implements a suitable Java interface *) let rewritten_jclass, new_classes = Javalib.remove_invokedynamics jclass ~prefix in