code: public static Object checkCompatibility(TypeRegistry registry, Object result, String expectedTypeDescriptor) {
  		if (GlobalConfiguration.assertsMode) {
  			Utils.assertTrue(result != null, "result should never be null");
  		}
  		String actualType = result.getClass().getName();
  		if (expectedTypeDescriptor.length() == 1
  				&& Utils.isObjectIsUnboxableTo(result.getClass(), expectedTypeDescriptor.charAt(0))) {
  			// boxing is ok
  		}
  		else {
  			if (expectedTypeDescriptor.charAt(0) == 'L') {
  				expectedTypeDescriptor = expectedTypeDescriptor.substring(1,
  						expectedTypeDescriptor.length() - 1).replace(
  								'/', '.');
  			}
  			if (!expectedTypeDescriptor.equals(actualType)) {
  				// assignability test
  				if (actualType.charAt(0) == '[' || expectedTypeDescriptor.charAt(0) == '[') {
  					return null;
  				}
  				// In some situations we can't easily see the descriptor for the actualType (e.g. it is loaded by a different, perhaps child, loader)
  				// Let's do something a bit more sophisticated here, we have the type information after all, we don't need to hunt for descriptors:
  				Class<?> actualClazz = result.getClass();
  				if (isAssignableFrom(registry, actualClazz, expectedTypeDescriptor.replace('/', '.'))) {
  					return result;
  				}
  				return null;
  			}
  		}
  		return result;
  	}
docs: Check that the value we have discovered is of the right type. It may not be if the field has changed type during
  a reload. When this happens we will default the value for the new field and forget the one we were holding onto.
  note: array forms are not compatible (e.g. int[] and Integer[])
  
  @param registry the type registry that can be quizzed for type information
  @param result the result we have discovered and are about to return - this is never null
  @param expectedTypeDescriptor the type we are looking for (will be primitive or Ljava/lang/String style)
  @return the result we can return, or null if it is not compatible