From 535e65c624224a6f9dd90ecf6f4741c0b2f5078e Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 8 May 2019 03:48:07 -0700 Subject: [PATCH] [demo] some minor improvements Summary: Ended up presenting this version at F8. Reviewed By: jeremydubreil Differential Revision: D15189643 fbshipit-source-id: 332b7c0da --- examples/demo/02/Resources.java | 14 +++++++------- examples/demo/02/ResourcesFixed.java | 6 +++--- examples/demo/03/Client.java | 1 - examples/demo/Makefile | 6 ++++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/examples/demo/02/Resources.java b/examples/demo/02/Resources.java index 4b74722d4..f00bb1adb 100644 --- a/examples/demo/02/Resources.java +++ b/examples/demo/02/Resources.java @@ -12,15 +12,15 @@ import java.io.IOException; class Resources { public static void cat() throws IOException { - FileInputStream fis = null; - FileOutputStream fos = null; + FileInputStream infile = null; + FileOutputStream outfile = null; try { - fis = new FileInputStream(new File("infile.txt")); - fos = new FileOutputStream(new File("outfile.txt")); - fos.write(fis.read()); + infile = new FileInputStream(new File("infile.txt")); + outfile = new FileOutputStream(new File("outfile.txt")); + outfile.write(infile.read()); } finally { - if (fis != null) fis.close(); - if (fos != null) fos.close(); + if (infile != null) infile.close(); + if (outfile != null) outfile.close(); } } } diff --git a/examples/demo/02/ResourcesFixed.java b/examples/demo/02/ResourcesFixed.java index 276ba645b..2285f0c6e 100644 --- a/examples/demo/02/ResourcesFixed.java +++ b/examples/demo/02/ResourcesFixed.java @@ -12,9 +12,9 @@ import java.io.IOException; public class ResourcesFixed { public static void cat() throws IOException { - try (FileInputStream fis = new FileInputStream(new File("infile.txt")); - FileOutputStream fos = new FileOutputStream(new File("outfile.txt")); ) { - fos.write(fis.read()); + try (FileInputStream infile = new FileInputStream(new File("infile.txt")); + FileOutputStream outfile = new FileOutputStream(new File("outfile.txt")); ) { + outfile.write(infile.read()); } } } diff --git a/examples/demo/03/Client.java b/examples/demo/03/Client.java index 157331fdb..0ea7582ef 100644 --- a/examples/demo/03/Client.java +++ b/examples/demo/03/Client.java @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -@ThreadSafe public class Client { Account account; diff --git a/examples/demo/Makefile b/examples/demo/Makefile index 5d61749d5..bd39ecab3 100644 --- a/examples/demo/Makefile +++ b/examples/demo/Makefile @@ -3,12 +3,14 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -SUBDIRS = 00 01 02 03 +SUBDIRS = 00 01 02 03 03.fixed 04 04.fixed default: all clean: $(foreach subdir,$(SUBDIRS),$(MAKE) -C $(subdir) clean;) rm -fr $(foreach subdir,$(SUBDIRS),$(subdir)/infer-out/) + rm -fr infer-out/ -all: $(OBJECTS) +all: + $(foreach subdir,$(SUBDIRS),$(MAKE) -C $(subdir) all;)