@Override protected void validateResourceState(Resource resource) { super.validateResourceState(resource); if (resource instanceof DerivedStateAwareResource && ((DerivedStateAwareResource) resource).isInitializing()) { LOG.error("Discouraged attempt to compute types during model inference. Resource was : "+resource.getURI(), new Exception()); } if (resource instanceof JvmMemberInitializableResource && ((JvmMemberInitializableResource) resource).isInitializingJvmMembers()) { LOG.error("Discouraged attempt to compute types during JvmMember initialization. Resource was : "+resource.getURI(), new Exception()); } }
/** * Checks the internal state of the resource and logs if type resolution was triggered unexpectedly. * If such a condition is detected, an {@link IllegalStateException exception} is thrown. * * @throws IllegalStateException if the resource is in an unexpected state. */ @Override protected void validateResourceState(Resource resource) { if (resource instanceof StorageAwareResource && ((StorageAwareResource) resource).isLoadedFromStorage()) { throw new IllegalStateException("Discouraged attempt to compute types for resource that was loaded from storage. Resource was : "+resource.getURI()); } if (resource instanceof DerivedStateAwareResource && ((DerivedStateAwareResource) resource).isInitializing()) { throw new IllegalStateException("Discouraged attempt to compute types during model inference. Resource was : "+resource.getURI()); } if (resource instanceof JvmMemberInitializableResource && ((JvmMemberInitializableResource) resource).isInitializingJvmMembers()) { throw new IllegalStateException("Discouraged attempt to compute types during JvmMember initialization. Resource was : "+resource.getURI()); } }