The State of Nevada Employees Association (“SNEA”) and individual employees1 argue on appeal that Nevada’s termination *1225of the right of public employees to withdraw their pension contributions without penalty constituted an unconstitutional impairment of contractual obligations and violated state law. The district court, after a three-day bench trial, decided (1) that plaintiffs’ claims were barred by res judicata, (2) that Nevada’s alterations to the public employees’ pension plan did not unconstitutionally impair the State’s contractual obligations, and (3) that the court would not exercise its discretionary jurisdiction over the pendent state claims because state law was not settled. We reverse in part and affirm in part.
I
From its inception, Nevada’s state employees’ pension plan permitted joint contributions by employers and employees. Nev. Rev.Stat. §§ 286.410, 286.450. Employees could withdraw their contribution at any time without penalty. Nev.Rev.Stat. § 286.410(4). In 1975, the Nevada legislature introduced an alternative pension system that permitted public employers to pay the entire contribution, but did not allow employees to withdraw pension funds without penalty prior to vesting. Nev.Rev.Stat. § 286.421.
In 1983, the Nevada legislature decided to increase pension benefits paid to employees who had retired. Nev.Rev.Stat. § 286.5756. To defray the costs of the post-retirement benefits increase, the legislature made employer-paid plans mandatory for all police officers and firefighters as of July 1, 1983, and for all other state employees effective July 1, 1985. Nev. Rev.Stat. § 286.421.
In 1983, SNEA along with individual police officers and firefighters challenged the State’s application of the mandatory employer-paid pension plan. State v. State of Nevada Employees Association, 102 Nev. 287, 720 P.2d 697 (1986). Pursuant to the statute, the employers had reduced the employees’ gross wages to offset the costs of the employer-paid contributions. The plaintiffs alleged that the state employers deducted more from their wages than was permitted under Nev.Rev.Stat. § 286.421. The Supreme Court of Nevada agreed. 102 Nev. 287, 720 P.2d 697.
SNEA and individual employees filed this action in 1984 challenging Nevada’s 1983 amendments eliminating the right of all public employees to withdraw their pension contributions without penalty. After a trial, the district court held sua sponte that plaintiffs’ claims were precluded. It additionally held that the 1983 amendments did not unconstitutionally impair the State’s contractual obligations, and it declined to exercise its discretionary pendent jurisdiction to decide the state law claims. Plaintiffs appeal.
II
The district court on its own motion decided that plaintiffs’ claims in this case are precluded by State v. State of Nevada Employees Association, 102 Nev. 287, 720 P.2d 697. Plaintiffs argue that the district court should not have raised res judicata sua sponte and that res judicata does not apply to this case. We review district court claim preclusion determinations de novo. Harbeson v. Parke Davis, Inc., 746 F.2d 517, 520 (9th Cir.1984).
Plaintiffs maintain that the State had the burden of raising res judicata as an affirmative defense. See Fed.R.Civ.P. 8(c). They contend that the State waived res judicata by failing to raise the issue, and they contend that the district court should not have raised res judicata sua sponte. There is merit to their position.
Res judicata must generally be affirmatively pleaded or waived. However, in McClain v. Apodaca, 793 F.2d 1031, 1032-1033 (9th Cir.1986), we held that it was appropriate for a bankruptcy court to raise res judicata sua sponte when it allowed the parties to submit post-trial briefs on the issue. In this case, the district court did not allow the parties to submit post-trial briefs on res judicata. Because the trial court did not subject its res judicata decision to the rigors of the adversarial process, we set aside that court’s conclusion *1226that res judicata bars plaintiffs’ claims.2
Ill
We review the district court’s findings of fact for clear error on the contract clause claim, and we review mixed questions of law and fact de novo. Wood v. Sunn, 865 F.2d 982, 986 (9th Cir.1988).
A
The contract clause provides that “No State shall ... pass any ... Law impairing the Obligation of Contracts_” U.S. Const., art. I, § 10, cl. 1. The Supreme Court invalidated a state law under the contract clause for the first time in decades in United States Trust Co. v. New Jersey, 431 U.S. 1, 97 S.Ct. 1505, 52 L.Ed.2d 92 (1977). The Court in Trust Co. declared a New Jersey statute unconstitutional because it impaired the state’s contractual obligations to bondholders of The Port Authority of New York and New Jersey.
The Supreme Court explained that “the [contract clause’s] prohibition is not an absolute one and is not to be read with literal exactness like a mathematical formula.” Id. at 21, 97 S.Ct. at 1517, quoting, Home Building Loan Association v. Blaisdell, 290 U.S. 398, 428, 54 S.Ct. 231, 236, 78 L.Ed. 413 (1934). To comply with the contract clause, impairments of state contractual obligations must be “reasonable and necessary to serve an important public purpose.” 431 U.S. at 25, 97 S.Ct. at 1519.
One year after Trust Co., the Supreme Court extended the Trust Co. holding to private contracts. In Allied Structural Steel Co. v. Spannaus, 438 U.S. 234, 98 S.Ct. 2716, 57 L.Ed.2d 727 (1978) the Court struck down a Minnesota statute which required private employers to pay a pension funding charge if they terminated a pension plan or closed an office in Minnesota when the funds in the pension plan were insufficient to cover full pensions for all employees who had worked at least ten years. The Court explained that the statute unconstitutionally modified the payment obligations of employers.
The Court retreated from its holding in Spannaus in Energy Reserves Group, Inc. v. Kansas Power & Light Co., 459 U.S. 400, 103 S.Ct. 697, 74 L.Ed.2d 569 (1983) and Exxon Corp. v. Eagerton, 462 U.S. 176, 103 S.Ct. 2296, 76 L.Ed.2d 497 (1983). See G. Gunther, Constitutional Law 498 (1985). In these cases, the Court indicated a renewed willingness to defer to the decisions of state legislatures regarding the impairment of private contracts. G. Gunther, Constitutional Law at 498. However, because Energy Reserves Group and Exxon did not involve impairments of public contracts, they have no direct effect on the Supreme Court’s holding in Trust Co.
The Supreme Court has not examined the constitutionality of a state law which impairs a public contract since Trust Co. The Court’s decisions' in Energy Reserves Group and Exxon do not indicate that the Court would defer to state legislatures when public as opposed to private contracts are at issue. As the Court explained in Trust Co., “complete deference to a legislative assessment of reasonableness and necessity is not appropriate because the State’s self-interest is at stake.” Id. at 26, 97 S.Ct. at 1519.
B
The State of Nevada conceded at oral argument that Trust Co. controls the outcome of this case. Accordingly, we must determine (1) whether Nevada’s public employee pension statutes create contractual obligations, (2) whether the 1983 amendments to the legislation substantially impaired the State’s contractual obligations, and (3) whether the impairment was reasonable and necessary to serve an important public purpose.
1
The State does not argue that Nevada’s statutes providing pensions for public employees do not create contractual obligations. Nevada’s Supreme Court has held *1227that the State’s public employees’ retirement system creates contractual rights for non-vested employees. Public Employees’ Retirement Board v. Washoe County, 96 Nev. 718, 615 P.2d 972, 974 (1980). Other courts consider pension rights of non-vested employees to be non-contractual gratuities. See, e.g., Creps v. Board of Firemen’s Relief & Retirement Fund Trustees, 456 S.W.2d 434 (Tex.Civ.App.1970).
Federal law, not Nevada law, controls whether the state statutes at issue create contractual rights protected by the contract clause. See Continental Illinois National Bank and Trust Co. of Chicago v. State of Washington, 696 F.2d 692, 698 (9th Cir.), appeal dismissed for lack of jurisdiction sub nom. The Don’t Bankrupt Washington Committee v. Continental Illinois National Bank and Trust Co. of Chicago, 460 U.S. 1077, 103 S.Ct. 1762, 76 L.Ed.2d 338 (1983); Pineman v. Oechslin, 637 F.2d 601, 604 (2d Cir.1981). However, we agree with the Nevada Supreme Court that “the modern and better-reasoned view” recognizes that non-vested employees have contractual rights in pension plans “subject to reasonable modification in order to keep the system flexible to meet changing conditions, and to maintain the actuarial soundness of the system.” 615 P.2d at 974-5.3
2
The district court did not explicitly analyze whether the 1983 amendments substantially impaired the State’s contractual obligations. Undoubtedly, the amendments impair contractual obligations by terminating the State’s obligation to allow public employees to withdraw pension contributions without penalty. However, the Nevada Supreme Court has explained that public employees’ contractual pension rights are subject to reasonable modification. Public Employees’ Retirement Board, 615 P.2d at 974-5. If the 1983 amendments constituted a reasonable modification of the pension plan, then they would not create a substantial impairment of contractual obligations.
“To be sustained as reasonable, the modification must bear some material relationship to the purpose of the pension system and its successful operation; and any disadvantage to employees must be accompanied by comparable new advantages.” Id. (citations omitted). In Public Employees’ Retirement Board Nevada’s Supreme Court invalidated a law which postponed retirement for public employees under the contract clause because the detriment was not offset by a .5% reduction in the contribution rate.
In this case, the State contends that with mandatory employer-paid contributions, public employees take home more money and retired employees receive a higher pension benefit. As to the State’s first contention, plaintiffs counter that the State’s analysis assumes that all public employees will work long enough to have their pension rights vest. Plaintiffs note that the rights of 93% of public employees will not vest. The higher take-home pay will therefore not offset the loss of the right to a refund of employee-paid contributions for the vast majority of employees.
Moreover, the loss of the right to withdraw pension contributions cannot be offset by the increase in post-retirement benefits. The State cannot justify impairing its contractual obligations to public employees by pointing to advantages accrued by former employees. See Abbott v. City of Los Angeles, 50 Cal.2d 438, 453, 326 P.2d 484, 492 (1958). The elimination of the right of public employees to withdraw pension contributions without penalty, like the law postponing retirement in Public Employees’ Retirement Board, substantially impaired the State’s contractual obligations.
*12283
States may substantially impair their contractual obligations when the impairment is “reasonable and necessary to serve an important public purpose.” Trust Co., 431 U.S. at 25, 97 S.Ct. at 1519. The legislature adopted mandatory employer-paid contributions as part of its plan to finance an increase in post-retirement benefits. The trial judge found, and plaintiffs concede, that increasing post-retirement benefits is an important public purpose. We must decide whether the contractual impairment was reasonable and necessary.
We believe that the changes in Nevada’s public employees’ pension scheme were not necessary. The district court found that “No reasonable alternative resulting in less impairment [than the implementation of mandatory employer-paid contributions] was suggested.” That factual finding is clearly erroneous.
Plaintiffs point out that the money raised by the elimination of the employees’ right to withdraw their pension fund contributions could have been raised by several other methods.4 They argue that “[t]he amortization period, extended 6 years as part of the funding package, could have been extended another few years to realize a .2% contribution rate savings; the 2% cap on the post-retirement increases could have been 1.8% or 1.9% to realize the same savings; the post retirement increases, already deferred for 3 years after retirement, could have been deferred 3 years.” The State did not address plaintiffs’ suggested alternatives. In fact, appellee Keat-ing testified before the Nevada legislature that the elimination of the right to withdraw pension fund contributions was not necessary to fund the increase in post-retirement benefits.
Nevada should not have interfered with the refund right of public employees when it was looking for ways to fund an increase in post-retirement benefits. States are not free to consider substantial contractual impairments on a par with other policy alternatives. Trust Co., 431 U.S. at 30-31, 97 S.Ct. at 1521-22. In this case, the State has not met its burden of proving that the impairment of the public employees’ pension rights was necessary to achieve an important public purpose. Id. at 31, 97 S.Ct. at 1522. We hold that the Nevada legislation unconstitutionally impaired the State’s contractual obligations.
IV
Plaintiffs argue that the district court should have decided their pendent state claims under Nev.Rev.Stat. §§ 284.175, 284.160, and 284.180. We review a district court’s decision not to exercise pendent jurisdiction for an abuse of discretion. Securities Investor Protection Corp. v. Vigman, 764 F.2d 1309, 1318 (9th Cir.1985). The district court declined to exercise pendent jurisdiction in this case because Nevada courts had not yet fleshed out the meaning of the statutes which plaintiffs asked it to apply.
The trial court did not abuse its discretion. It did not have to examine the state statutes because Nevada “courts ha[d] not interpreted [the statutes] to any significant degree.” Forsberg v. Pacific Northwest Bell Telephone Co., 840 F.2d 1409, 1421 (9th Cir.1988).
V
We reverse the district court’s holdings that plaintiffs’ claims are barred by res judicata, and that the elimination of. the right of non-vested public employees to withdraw pension plan contributions did not violate the contract clause. However, we affirm the trial court’s decision not to exercise pendent jurisdiction. The State shall bear plaintiffs’ costs for this appeal.
REVERSED IN PART AND AFFIRMED IN PART
. SNEA and the individual employees will be collectively referred to as “plaintiffs.”
. In any event, we note that most of the plaintiffs in this case are not police officers or firefighters and are not similarly situated to the plaintiffs in the earlier action.
. The Nevada Supreme Court explained that “employees accept their positions, perform their duties, and contribute to the retirement fund in reliance upon the governmental employer’s promise to pay retirement benefits_ By rendering services and making contributions, an employee acquires a limited vested right to pension benefits which may not be eliminated or substantially changed by unilateral action of the governmental employer to the detriment of the member.” 615 P.2d at 974.
. The removal of the employees’ right to withdraw their pension fund contributions raised .2% of the total 4.2% increase in the contribution rate needed to fund the post-retirement benefits increase.