Massachusetts General Laws
Chapter 231a - Procedure for Declaratory Judgments
Section 8 - Necessary Parties; Class Actions

Section 8. When declaratory relief is sought, all persons shall be made parties who have or claim any interest which would be affected by the declaration, and no declaration shall prejudice the rights of persons not parties to the proceeding. In any proceeding which involves the validity of a municipal ordinance or by-law or of a franchise, license, easement or other privilege granted by the commonwealth or a municipality thereof, the municipality, or the agency granting the privilege, as the case may be, shall be made a party and shall be entitled to be heard. If a question of constitutionality is involved in any proceeding under this chapter, the attorney general shall also be notified of the proceeding and be entitled to be heard.
Nothing set forth in this section shall bar the bringing of a class action for declaratory relief pursuant to the new rules of civil procedure.
Following entry of a final decree or order favorable to the petitioner or petitioners in a class suit, any member of said class thereafter aggrieved by any violation of said order or decree shall be entitled to compel compliance therewith by instituting contempt proceedings in said class suit.