Add assertions (and fixes) on the construction of AstNode and JavaTree