[demo] some minor improvements

Summary: Ended up presenting this version at F8.

Reviewed By: jeremydubreil

Differential Revision: D15189643

fbshipit-source-id: 332b7c0da
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 144847219e
commit 535e65c624

@ -12,15 +12,15 @@ import java.io.IOException;
class Resources { class Resources {
public static void cat() throws IOException { public static void cat() throws IOException {
FileInputStream fis = null; FileInputStream infile = null;
FileOutputStream fos = null; FileOutputStream outfile = null;
try { try {
fis = new FileInputStream(new File("infile.txt")); infile = new FileInputStream(new File("infile.txt"));
fos = new FileOutputStream(new File("outfile.txt")); outfile = new FileOutputStream(new File("outfile.txt"));
fos.write(fis.read()); outfile.write(infile.read());
} finally { } finally {
if (fis != null) fis.close(); if (infile != null) infile.close();
if (fos != null) fos.close(); if (outfile != null) outfile.close();
} }
} }
} }

@ -12,9 +12,9 @@ import java.io.IOException;
public class ResourcesFixed { public class ResourcesFixed {
public static void cat() throws IOException { public static void cat() throws IOException {
try (FileInputStream fis = new FileInputStream(new File("infile.txt")); try (FileInputStream infile = new FileInputStream(new File("infile.txt"));
FileOutputStream fos = new FileOutputStream(new File("outfile.txt")); ) { FileOutputStream outfile = new FileOutputStream(new File("outfile.txt")); ) {
fos.write(fis.read()); outfile.write(infile.read());
} }
} }
} }

@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
@ThreadSafe
public class Client { public class Client {
Account account; Account account;

@ -3,12 +3,14 @@
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # 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 default: all
clean: clean:
$(foreach subdir,$(SUBDIRS),$(MAKE) -C $(subdir) clean;) $(foreach subdir,$(SUBDIRS),$(MAKE) -C $(subdir) clean;)
rm -fr $(foreach subdir,$(SUBDIRS),$(subdir)/infer-out/) rm -fr $(foreach subdir,$(SUBDIRS),$(subdir)/infer-out/)
rm -fr infer-out/
all: $(OBJECTS) all:
$(foreach subdir,$(SUBDIRS),$(MAKE) -C $(subdir) all;)

Loading…
Cancel
Save