comparison graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java @ 21662:b45e0f791465

avoid double assignment
author Doug Simon <doug.simon@oracle.com>
date Tue, 02 Jun 2015 15:15:23 +0200
parents 6d9c8d0d0f7c
children 2e8c01def9a5
comparison
equal deleted inserted replaced
21661:ccf89c722ac8 21662:b45e0f791465
82 public static <S> S loadSingle(Class<S> service, boolean required) { 82 public static <S> S loadSingle(Class<S> service, boolean required) {
83 SecurityManager sm = System.getSecurityManager(); 83 SecurityManager sm = System.getSecurityManager();
84 if (sm != null) { 84 if (sm != null) {
85 sm.checkPermission(new RuntimePermission("jvmciServices")); 85 sm.checkPermission(new RuntimePermission("jvmciServices"));
86 } 86 }
87 Iterable<S> impls = null; 87 Iterable<S> impls;
88 if (Service.class.isAssignableFrom(service)) { 88 if (Service.class.isAssignableFrom(service)) {
89 try { 89 try {
90 impls = (Iterable<S>) cache.get(service); 90 impls = (Iterable<S>) cache.get(service);
91 } catch (UnsatisfiedLinkError e) { 91 } catch (UnsatisfiedLinkError e) {
92 // Fall back to standard ServiceLoader 92 // Fall back to standard ServiceLoader
93 impls = null;
93 } 94 }
95 } else {
96 impls = null;
94 } 97 }
95 98
96 if (impls == null) { 99 if (impls == null) {
97 // Need to use the ClassLoader of the caller 100 // Need to use the ClassLoader of the caller
98 ClassLoader cl = Reflection.getCallerClass().getClassLoader(); 101 ClassLoader cl = Reflection.getCallerClass().getClassLoader();