protected static <S> void verifyIsOuterClass(
		Class<S> serviceClass, Class<? extends S> providerClass, Scope scope)
		throws ServiceInstantiationException {

		// If it's an inner class, it must be declared static
		Class<?> declaringClass=providerClass.getDeclaringClass();
		if (declaringClass!=null) {
			Class<?>[] innerClasses=declaringClass.getDeclaredClasses();
			for (Class<?> innerClass: innerClasses) {
				if (!Modifier.isStatic(innerClass.getModifiers())) {
					throw new ServiceInstantiationException(serviceClass,
						"Could not instantiate service provider class "+
						providerClass.getName()+" of service type "+
						serviceClass.getName()+" in scope \""+scope+
						"\" because it is an non-static inner class");
				}
			}
		}
	}