ENG-6419 Fixed tree structure checks so it passes on java 8