docs: private InjectionTarget[] getInjectionTargets(BeanMetaData bmd,
                                                    Class<?> beanClass) throws InjectionException, EJBConfigurationException {
          InjectionTarget[] targets = bmd.ivReferenceContext.getInjectionTargets(beanClass);
  
          if (!bmd.usesBeanManagedTx &&
              bmd.type != InternalConstants.TYPE_MANAGED_BEAN) {
              for (InjectionTarget target : targets) {
                  if (target.getInjectionBinding().getInjectionClassType() == UserTransaction.class) {
                      Tr.error(tcInjection, "INJECTING_INCORRECT_TX_INTO_BEAN_CWNEN0043E");
                      throw new EJBConfigurationException("Injecting a UserTransaction into a" +
                                                          " container-managed transaction bean is not allowed");
                  }
              }
          }
  
          // No need to perform any sorting if the existing array isn't big enough
          if (targets.length <= 1) {
              return targets;
          }
  
          int nextField = 0;
          boolean sorted = false;
          ArrayList<InjectionTarget> sortedTargets = new ArrayList<InjectionTarget>(targets.length);
  
          for (InjectionTarget target : targets) {
              Member targetMember = target.getMember();
  
              // If this target is for a field, then add it just prior to the first
              // method; the fields will remain in the same order as produced by the
              // injection engine, though that shouldn't really matter.
              if (targetMember instanceof Field) {
                  sortedTargets.add(nextField, target);
                  ++nextField;
              }
  
              // Must be a method, so if it is an EJBContext, then add it to the
              // beginning of the list, ahead of both methods and fields; otherwise
              // add it to the end.
              else {
                  Class<?> targetType = target.getInjectionBinding().getInjectionClassType();
                  if (targetType != null && // d718208
                      EJBContext.class.isAssignableFrom(targetType)) {
                      if ((SessionBean.class.isAssignableFrom(beanClass) &&
                           "setSessionContext".equals(targetMember.getName()))
                          ||
                          (MessageDrivenBean.class.isAssignableFrom(beanClass) &&
                           "setMessageDrivenContext".equals(targetMember.getName()))) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                              Tr.debug(tc, "Skipping Session/MessageDrivenBean set context method : " + target);
                          sorted = true;
                      } else {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                              Tr.debug(tc, "Sorting EJBContext set method to first in list : " + target);
                          sortedTargets.add(0, target);
                          sorted = true;
                          ++nextField;
                      }
                  } else {
                      sortedTargets.add(target);
                  }
              }
          }
  
          // Only copy the array if the order or size has changed.
          if (sorted) {
              return sortedTargets.toArray(new InjectionTarget[sortedTargets.size()]);
          }
  
          // No sorting was performed, return the original array.
          return targets;
      }