If the land demanded has been actually held and possessed by the defendant and by those under whom he claims for six years next before the commencement of the action, he shall, if judgment is against him, be entitled to compensation as hereinafter provided for the value of any buildings or improvements made or erected on the land by him or by any person under whom he claims.
Mass. Gen. Laws ch. 237, § 16