changeset 21633:9966b358bc2b

Services: don't throw exceptions or print warnings when there are no implementations for a non-required service
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Mon, 01 Jun 2015 15:14:20 +0200
parents abcb811659e0
children 0a2fc09f6ed6
files graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java src/share/vm/jvmci/jvmciRuntime.cpp
diffstat 2 files changed, 2 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java	Mon Jun 01 15:13:16 2015 +0200
+++ b/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java	Mon Jun 01 15:14:20 2015 +0200
@@ -22,8 +22,6 @@
  */
 package com.oracle.jvmci.service;
 
-import static java.lang.String.*;
-
 import java.util.*;
 
 import sun.reflect.*;
@@ -39,13 +37,7 @@
     private static final ClassValue<List<Service>> cache = new ClassValue<List<Service>>() {
         @Override
         protected List<Service> computeValue(Class<?> type) {
-            Service[] names = getServiceImpls(type);
-            if (names == null || names.length == 0) {
-                throw new InternalError(
-                                format("No implementations for %s found (ensure %s extends %s and that in suite.py the \"annotationProcessors\" attribute for the project enclosing %s includes \"com.oracle.jvmci.service.processor\")",
-                                                type.getSimpleName(), type.getSimpleName(), Service.class, type.getSimpleName()));
-            }
-            return Arrays.asList(names);
+            return Arrays.asList(getServiceImpls(type));
         }
     };
 
--- a/src/share/vm/jvmci/jvmciRuntime.cpp	Mon Jun 01 15:13:16 2015 +0200
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Mon Jun 01 15:14:20 2015 +0200
@@ -1205,7 +1205,7 @@
   char sep = os::file_separator()[0];
   sprintf(path, "%s%clib%cjvmci%cservices%c%s", home, sep, sep, sep, sep, serviceName);
   ServiceParseClosure closure;
-  parse_lines(path, &closure, true); // TODO(gd) cache parsing results?
+  parse_lines(path, &closure, false);
 
   GrowableArray<char*>* implNames = closure.implNames();
   objArrayOop servicesOop = oopFactory::new_objArray(serviceKlass(), implNames->length(), CHECK_(objArrayHandle()));