private void cacheLayoutPositions() {
   for (int i = 0; i < getChildCount(); i++) {
     final ViewConstraints viewConstraints = mViewConstraints[i];
     final View v = viewConstraints.getView();
     if (viewConstraints.isHorizontalSpring() && !viewConstraints.isHorizontalSpringUsed()) {
       throw new IllegalStateException(
           "Horizontal weight defined but never used, please review your layout. Remember that the chain of views cannot divert when using springs: Problematic view (please also check other dependant views): "
               + v
               + ", problematic layout: "
               + this);
     } else if (viewConstraints.isVerticalSpring() && !viewConstraints.isVerticalSpringUsed()) {
       throw new IllegalStateException(
           "Vertical weight defined but never used, please review your layout. Remember that the chain of views cannot divert when using springs: Problematic view (please also check other dependant views): "
               + v
               + ", problematic layout: "
               + this);
     } else {
       int anchor = 0;
       try {
         LayoutParams st = (LayoutParams) v.getLayoutParams();
         anchor = LEFT;
         st.left = viewConstraints.innerLeft.getValue();
         anchor = RIGHT;
         st.right = viewConstraints.innerRight.getValue();
         anchor = TOP;
         st.top = viewConstraints.innerTop.getValue();
         anchor = BOTTOM;
         st.bottom = viewConstraints.innerBottom.getValue();
         v.measure(
             MeasureSpec.makeMeasureSpec(st.right - st.left, MeasureSpec.EXACTLY),
             MeasureSpec.makeMeasureSpec(st.bottom - st.top, MeasureSpec.EXACTLY));
       } catch (IllegalStateException e) {
         throw new IllegalStateException(
             "View "
                 + ANCHOR_NAMES[anchor]
                 + " position could not be calculated, please review your layout. Remember that A.above = B and B.below = A are not equivalent in terms of calculation order, please refer to documentation. Problematic view (please also check other dependant views): "
                 + v
                 + ", problematic layout: "
                 + this,
             e);
       } catch (StackOverflowError e) {
         throw new IllegalStateException(
             "Constraints of a view could not be resolved (circular dependency), please review your layout. Problematic view (please also check other dependant views): "
                 + v
                 + ", problematic layout: "
                 + this);
       }
     }
   }
 }