1 // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file 2 // for details. All rights reserved. Use of this source code is governed by a 3 // BSD-style license that can be found in the LICENSE file. 4 package trywithresources; 5 6 public class TryWithResourcesDesugaredTests extends TryWithResources { isAndroid()7 private boolean isAndroid() { 8 try { 9 Class.forName("dalvik.system.VMRuntime"); 10 return true; 11 } catch (Exception ignored) { 12 } 13 return false; 14 } 15 16 @Override desugaredCodeRunningOnJvm()17 boolean desugaredCodeRunningOnJvm() { 18 return !isAndroid(); 19 } 20 main(String[] args)21 public static void main(String[] args) throws Exception { 22 new TryWithResourcesDesugaredTests().test(); 23 } 24 } 25