From 51cd3ded47d3baf76d0a2fc523105ca02e580528 Mon Sep 17 00:00:00 2001 From: jrm Date: Tue, 5 Jan 2016 16:33:29 -0800 Subject: [PATCH] make sure that the Infer out directory is empty before generating the models Summary: public While playing with the type environment for Java, I realised that the types in models.jar where not re-generated when modifying Infer. As a consequence, some changes in Infer where surprisingly having no effect. This diff forces the type environment to be absent when analyzing the models. Reviewed By: sblackshear Differential Revision: D2802517 fb-gh-sync-id: 1c2673a --- infer/models/java/Makefile.in | 2 ++ infer/src/java/jMain.ml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/infer/models/java/Makefile.in b/infer/models/java/Makefile.in index 03e7496d3..5ea10b3f2 100644 --- a/infer/models/java/Makefile.in +++ b/infer/models/java/Makefile.in @@ -28,9 +28,11 @@ all: $(MODELS_JAR) clean: @rm -fr $(MODELS_OUT) + @rm -f $(MODELS_JAR) @rm -f $(DEPLOYED_MODELS_JAR) $(INFER_REPORT): $(ANDROID_JAR) $(JACKSON_JAR) $(JAVA_SOURCES) $(JAVA_DEPS) + @rm -fr $(MODELS_OUT) mkdir -p $(MODELS_OUT) @rm -f $(DEPLOYED_MODELS_JAR) $(INFER) -- javac -bootclasspath $(ANDROID_JAR) -d $(MODELS_OUT) -classpath $(JACKSON_JAR) $(JAVA_SOURCES) diff --git a/infer/src/java/jMain.ml b/infer/src/java/jMain.ml index 2b99d4872..b3b44a6b0 100644 --- a/infer/src/java/jMain.ml +++ b/infer/src/java/jMain.ml @@ -123,6 +123,12 @@ let load_tenv program = begin match Sil.load_tenv_from_file tenv_filename with | None -> Sil.create_tenv () + | Some _ when Config.analyze_models -> + let error_msg = + "Unexpected tenv file " + ^ (DB.filename_to_string tenv_filename) + ^ " found while generating the models" in + failwith error_msg | Some tenv -> tenv end else