diff options
author | mikaelpeltier <mikaelpeltier@google.com> | 2015-04-03 09:58:11 +0200 |
---|---|---|
committer | mikaelpeltier <mikaelpeltier@google.com> | 2015-04-07 16:39:49 +0200 |
commit | a26140be0f0575cc9c046ffe03908e1fc0435fe7 (patch) | |
tree | ee0478845926fc51ff960340c08fdb2e37e665a8 | |
parent | b645908a436ee68af9a556ad12570d4c4653f55c (diff) | |
download | toolchain_jack-a26140be0f0575cc9c046ffe03908e1fc0435fe7.zip toolchain_jack-a26140be0f0575cc9c046ffe03908e1fc0435fe7.tar.gz toolchain_jack-a26140be0f0575cc9c046ffe03908e1fc0435fe7.tar.bz2 |
Remove warnings
Change-Id: I9c5eb7bc2bf9a7ee1a07e7620eed16f739f2b965
-rw-r--r-- | jack/src/com/android/jack/Jack.java | 7 | ||||
-rw-r--r-- | jack/src/com/android/jack/incremental/CommonFilter.java | 8 | ||||
-rw-r--r-- | jack/tests/com/android/jack/TestTools.java | 5 | ||||
-rw-r--r-- | jack/tests/com/android/jack/test/TestsProperties.java | 23 |
4 files changed, 28 insertions, 15 deletions
diff --git a/jack/src/com/android/jack/Jack.java b/jack/src/com/android/jack/Jack.java index 83a3cdc..aba7be9 100644 --- a/jack/src/com/android/jack/Jack.java +++ b/jack/src/com/android/jack/Jack.java @@ -305,12 +305,6 @@ public abstract class Jack { public static final ObjectId<JSession> SESSION = new ObjectId<JSession>("jack.session", JSession.class); - /** - * List of folders inside Jack jar file that can be used as embedded default jack libraries. - */ - @Nonnull - public static final String[] JACK_DEFAULT_LIB_PATH = new String[]{"jack-default-lib"}; - // Compilation configuration kept in a static field to avoid ThreadConfig overhead @CheckForNull private static UnmodifiableCollections unmodifiableCollections; @@ -1282,6 +1276,7 @@ public abstract class Jack { } } + assert version != null; return version; } diff --git a/jack/src/com/android/jack/incremental/CommonFilter.java b/jack/src/com/android/jack/incremental/CommonFilter.java index 3f7c2d1..758423d 100644 --- a/jack/src/com/android/jack/incremental/CommonFilter.java +++ b/jack/src/com/android/jack/incremental/CommonFilter.java @@ -74,6 +74,12 @@ import javax.annotation.Nonnull; */ public abstract class CommonFilter { + /** + * List of folders inside Jack jar file that can be used as embedded default jack libraries. + */ + @Nonnull + private static final String[] JACK_DEFAULT_LIB_PATH = new String[]{"jack-default-lib"}; + private static final class FailedToLocateJackJarException extends Exception { private static final long serialVersionUID = 1L; @@ -242,7 +248,7 @@ public abstract class CommonFilter { List<InputLibrary> libraries = new ArrayList<InputLibrary>(); try { File jackJar = new File(location.toURI().getPath()); - for (String prefix: Jack.JACK_DEFAULT_LIB_PATH) { + for (String prefix: JACK_DEFAULT_LIB_PATH) { VFS jackVfs = new PrefixedFS(new ReadZipFS(new InputZipFile(jackJar.getPath(), session.getHooks(), Existence.MUST_EXIST, diff --git a/jack/tests/com/android/jack/TestTools.java b/jack/tests/com/android/jack/TestTools.java index 41712bb..223e4da 100644 --- a/jack/tests/com/android/jack/TestTools.java +++ b/jack/tests/com/android/jack/TestTools.java @@ -261,8 +261,9 @@ public class TestTools { public static Options buildCommandLineArgs(@Nonnull File fileOrSourcelist, @CheckForNull File jarjarRules) throws IOException { Options options = buildCommandLineArgs(null /* classpath */, new File[] {fileOrSourcelist}); - options.setJarjarRulesFile(jarjarRules); - + if (jarjarRules != null) { + options.setJarjarRulesFile(jarjarRules); + } return options; } diff --git a/jack/tests/com/android/jack/test/TestsProperties.java b/jack/tests/com/android/jack/test/TestsProperties.java index a11c3e0..1956f18 100644 --- a/jack/tests/com/android/jack/test/TestsProperties.java +++ b/jack/tests/com/android/jack/test/TestsProperties.java @@ -54,13 +54,24 @@ public class TestsProperties { if (!propertyFile.exists()) { throw new TestConfigurationException("Configuration file not found: '" + filePath + "'"); } - try { - testsProperties.load(new FileInputStream(propertyFile)); - } catch (FileNotFoundException e) { - throw new TestConfigurationException(e); - } catch (IOException e) { - throw new TestConfigurationException(e); + + FileInputStream is = null; + try { + is = new FileInputStream(propertyFile); + testsProperties.load(is); + } catch (FileNotFoundException e) { + throw new TestConfigurationException(e); + } catch (IOException e) { + throw new TestConfigurationException(e); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + // No need to manage failure when closing input stream + } } + } String jackHome = testsProperties.getProperty("jack.home"); |