
35 Cal.Rptr.3d 487 (2005)
133 Cal.App.4th 1013
John ZIPPERER et al., Plaintiffs and Appellants,
v.
COUNTY OF SANTA CLARA, Defendant and Respondent.
No. H028455.
Court of Appeal, Sixth District.
September 30, 2005.
As Modified October 28, 2005.
*489 Albin E. Danell, San Jose, CA, for Plaintiffs and Appellants.
Michael L. Rossi, Office of the County Counsel, San Jose, CA, for Defendant and Respondent.
Certified for Partial Publication.[*]
McADAMS, J.
Plaintiffs John and Cecilia Zipperer sued the County of Santa Clara on various theories, based on allegations that their solar home was malfunctioning as a result of shading from trees growing on defendant's adjoining property. The trial court sustained defendant's demurrer to plaintiffs' first amended complaint, without leave to amend. This appeal followed. For reasons explained in the opinion, we agree with the trial court's determination that plaintiffs have not stated any cause of action against defendant, nor is there any reasonable possibility that the defects in their complaint can be cured by amendment. Treating the order sustaining the demurrer as a judgment of dismissal, we therefore affirm.


*490 FACTS[1]
In the mid-1980s, plaintiffs built a solar home on their property in Los Gatos, after obtaining permits to do so from defendant.
In 1991, defendant acquired a parcel of land that adjoins plaintiffs' property, and defendant placed that land in a Parks Reserve. There is a grove of five or six trees growing on defendant's land. Since 1991, those trees have been growing at the rate of 10 to 15 feet per year. By 2004, the trees were about 100 feet taller than when defendant acquired the land.
In 1997, plaintiffs' solar system began to malfunction because the trees on defendant's land interfered with the sunlight reaching their solar panels. Despite numerous requests from plaintiffs, and notwithstanding verbal promises by "certain officials and certain individuals that this situation would be corrected," defendant did not trim or remove the trees.

PROCEDURAL HISTORY
In April and May 2004, plaintiffs filed tort claims with defendant. According to plaintiffs, "there was no time limit" for filing these claims, because their injury was of a "continuing" nature. Defendant rejected the claims.
In May 2004, plaintiffs brought this action against defendant. The verified complaint asserted causes of action for nuisance, trespass, statutory violations constituting negligence, and intentional infliction of emotional distress. As to their negligence claim, plaintiffs alleged that defendant violated various statutes, including the Solar Shade Control Act.
In July 2004, defendant demurred to the complaint. In support of its demurrer, defendant asked the trial court to take judicial notice of a Santa Clara County ordinance entitled "Exemption from Solar Shade Control Act." Plaintiffs opposed the demurrer, but not defendant's request for judicial notice.
In September 2004, after a hearing on the matter, the trial court sustained defendant's demurrer, granting plaintiffs leave to amend their complaint within 20 days.
Plaintiffs filed a verified first amended complaint in September 2004. Among other things, the amended complaint asserted a new cause of action for breach of contract, as well plaintiffs' previous claims for nuisance, negligence, trespass, violation of statute, and emotional distress. As to their new contract claim, plaintiffs alleged a contract with defendant based on its grant of building permits for their solar home. Plaintiffs attached the permits as an exhibit to the amended complaint.
The first amended complaint drew another demurrer, which defendant filed in October 2004. Again, plaintiffs opposed the demurrer.
Following a hearing held in December 2004, the trial court entered its formal order sustaining defendant's demurrer without leave to amend. Defendant gave notice of the order in January 2005.
This appeal ensued.

THRESHOLD ISSUES
Before analyzing the substantive issues raised in this appeal, we first address two threshold procedural questions: whether we may review the challenged order at all, and if so, what standards govern that review.


*491 Appealability

Although plaintiffs' form notice of appeal refers to a judgment of dismissal, the appellate record contains no judgment. This appeal thus appears to have been taken from the order sustaining defendant's demurrer to plaintiffs' first amended complaint, without leave to amend. "Orders sustaining demurrers are not appealable." (Hill v. City of Long Beach (1995) 33 Cal.App.4th 1684, 1695, 40 Cal.Rptr.2d 125.) But "an appellate court may deem an order sustaining a demurrer to incorporate a judgment of dismissal." (Molien v. Kaiser Foundation Hospitals (1980) 27 Cal.3d 916, 920, 167 Cal.Rptr. 831, 616 P.2d 813.) It is particularly appropriate to do so when the absence of a final judgment results from inadvertence or mistake. (Id. at p. 921, 167 Cal.Rptr. 831, 616 P.2d 813.)
In this case, defendant does not argue for dismissal of the appeal, and the issues are fully briefed. (See Gu v. BMW of North America, LLC, supra, 132 Cal.App.4th 195, 33 Cal.Rptr.3d 617.) Under the circumstances, we will decide this case on its merits by treating the order as incorporating a judgment of dismissal.

Standard and Scope of Review
We review a trial court's decision to sustain a demurrer for an abuse of discretion. (See, e.g., Hendy v. Losse (1991) 54 Cal.3d 723, 742, 1 Cal.Rptr.2d 543, 819 P.2d 1.) We likewise review a trial court's denial of leave to amend for an abuse of discretion. (Ibid.) "As a general rule, if there is a reasonable possibility the defect in the complaint could be cured by amendment, it is an abuse of discretion to sustain a demurrer without leave to amend." (City of Atascadero v. Merrill Lynch, Pierce, Fenner & Smith, Inc. (1998) 68 Cal.App.4th 445, 459-460, 80 Cal.Rptr.2d 329. See also, e.g., Schifando v. City of Los Angeles (2003) 31 Cal.4th 1074, 1081, 6 Cal.Rptr.3d 457, 79 P.3d 569; Gu v. BMW of North America, LLC, supra, 132 Cal.App.4th 195, 33 Cal.Rptr.3d 617.) "Nevertheless, where the nature of the plaintiff's claim is clear, and under substantive law no liability exists, a court should deny leave to amend because no amendment could change the result." (City of Atascadero, at pp. 459-460, 80 Cal.Rptr.2d 329.)
In analyzing the existence of liability under the governing substantive law, "we exercise our independent judgment about whether the complaint states a cause of action as a matter of law." (Montclair Parkowners Assn. v. City of Montclair (1999) 76 Cal.App.4th 784, 790, 90 Cal.Rptr.2d 598.)
"In reviewing the sufficiency of a complaint against a general demurrer, we are guided by long-settled rules. `We treat the demurrer as admitting all material facts properly pleaded, but not contentions, deductions or conclusions of fact or law. [Citation.] We also consider matters which may be judicially noticed.' [Citation.] Further, we give the complaint a reasonable interpretation, reading it as a whole and its parts in their context." (Blank v. Kirwan (1985) 39 Cal.3d 311, 318, 216 Cal.Rptr. 718, 703 P.2d 58.)
On appeal, "the plaintiff bears the burden of demonstrating that the trial court erred." (Cantu v. Resolution Trust Corp. (1992) 4 Cal.App.4th 857, 879, 6 Cal.Rptr.2d 151.) If the claimed error is the trial court's refusal to permit amendment of the complaint, the "plaintiff has the burden of proving that an amendment would cure the defect." (Schifando v. City of Los Angeles, supra, 31 Cal.4th at p. 1081, 6 Cal.Rptr.3d 457, 79 P.3d 569.)
*492 In this case, plaintiffs bear the further burden of particularity in pleading their tort-based causes of action, since defendant is a public entity. "Under the Government Tort Liability Act, all liability is statutory. Hence, the rule that statutory causes of action must be specifically pleaded applies, and every element of the statutory basis for liability must be alleged." (4 Witkin, Cal. Procedure (4th ed. 1997) Pleading, § 579, pp. 675-676. See, e.g., Lopez v. Southern Cal. Rapid Transit Dist. (1985) 40 Cal.3d 780, 792-793, 221 Cal.Rptr. 840, 710 P.2d 907.)
With those principles in mind, we consider the sufficiency of plaintiffs' complaint under the governing substantive law.

ANALYSIS
In the unpublished portion of this opinion, we address each of the six asserted causes of action of plaintiffs' first amended complaint. We conclude that none is viable nor is there any reasonable possibility of cure. In the published portion of this opinion, we discuss only plaintiffs' third cause of action, which asserts negligence.


First Cause of Action: Breach of Contract[**]

Third Cause of Action: Negligence
One essential element of a cause of action for negligence is a legal duty. (Potter v. Firestone Tire & Rubber Co. (1993) 6 Cal.4th 965, 984, 25 Cal.Rptr.2d 550, 863 P.2d 795.) "That duty may be imposed by law, be assumed by the defendant, or exist by virtue of a special relationship." (Id. at p. 985, 25 Cal.Rptr.2d 550, 863 P.2d 795.) In this case, plaintiffs base their negligence claim on the asserted breach of a statutory duty arising under the Solar Shade Control Act. (See Pub. Res.Code, §§ 25980-25986.)[3]

Governing Substantive Law: The Solar Shade Control Act
"The Solar Shade Control Act ... provides limited protection to owners of solar collectors from shading caused by trees on adjacent properties." (Sher v. Leiderman, supra, 181 Cal.App.3d at p. 880, 226 Cal.Rptr. 698.) Enacted in 1978, the Act has been described as "protecting active or passive solar energy systems (SES's) against obstruction by later-planted or later-grown trees and foliage...." (Kucera v. Lizza, supra, 59 Cal.App.4th at p. 1152, 69 Cal.Rptr.2d 582, statutory citation omitted.)
In pertinent part, the Act provides: "After January 1, 1979, no person owning, or in control of a property shall allow a tree or shrub to be placed, or, if placed, to grow on such property, subsequent to the installation of a solar collector on the property of another so as to cast a shadow greater than 10 percent of the collector absorption area" during mid-day hours as specified in the statute. (§ 25982; see generally, 11 Witkin, Summary of Cal. Law, supra, Equity, § 137 p. 820.)
The Act permits local jurisdictions to exempt themselves from its operation. The exemption provision states: "Any city, or for unincorporated areas, any county, may adopt, by majority vote of the governing body, an ordinance exempting their jurisdiction from the provisions of this chapter. The adoption of such an ordinance shall not be subject to the provisions of the California Environmental Quality Act (commencing with Section 21000)." (§ 25985.)


*493 The Parties' Contentions
The parties disagree on whether the Solar Shade Control Act applies in this case.[4] Under defendant's interpretation of the Act, there can be no liability here because defendant did not plant or "place" the trees for purposes of the statute. In other words, there is no statutory violation because these were not "later-planted" trees. (Kucera v. Lizza, supra, 59 Cal.App.4th at p. 1152, 69 Cal.Rptr.2d 582.) Plaintiffs dispute that interpretation, urging that defendant is liable under the Act, because it permitted the trees to grow. As plaintiffs see it, liability attaches for these "later-grown" trees. (Ibid.)
The parties also disagree about the statutory exemption. Defendant asserts that it is exempt from the Act, having adopted an ordinance as authorized by section 25985. Plaintiffs argue against application of the exemption here, asserting "that there was already in existence a continuing duty on the part of the County" when it adopted the ordinance and a continuing breach of that duty when plaintiffs' solar system began to fail. Plaintiffs thus contend: "The County should be liable for any of the damages they had already caused." They characterize defendant's use of the exemption provision as "a quasi-ex post facto application on the part of the County." As we understand it, the essence of plaintiffs' argument on this point is that defendant's ordinance offends constitutional principles because it operates retroactively, defeating their preexisting damage claims. Defendant does not specifically meet that contention.

Analysis
As we now explain, plaintiffs' statutory claim cannot be maintained because defendant is exempt from the Solar Shade Control Act by virtue of its adoption of a qualifying ordinance, as permitted by section 25985. Given that determination, we need not address the parties' differing interpretations of other provisions of the Act.
"`In passing on the validity of an ordinance or a statute it will be presumed that it is valid.'" (City of Industry v. Willey (1970) 11 Cal.App.3d 658, 663, 89 Cal.Rptr. 922.) "We interpret ordinances by the same rules applicable to statutes." (Carson Harbor Village, Ltd. v. City of Carson Mobilehome Park Rental Review Bd. (1999) 70 Cal.App.4th 281, 290, 82 Cal.Rptr.2d 569.)
Here, plaintiffs do not make a facial attack on the validity of either the ordinance or the enabling statute. Instead, they object to defendant's use of the statutory exemption to the extent that it operates retrospectively to extinguish their statutory claims.
"Although the courts normally construe statutes to operate prospectively, the courts correlatively hold under the common law that when a pending action rests solely on a statutory basis, and when no rights have vested under the statute, `a repeal of such a statute without a saving clause will terminate all pending actions based thereon.'" (Governing Board v. Mann (1977) 18 Cal.3d 819, 829, 135 Cal.Rptr. 526, 558 P.2d 1.) In other words, *494 where "the Legislature has conferred a remedy and withdraws it by amendment or repeal of the remedial statute, the new statutory scheme may be applied to pending actions without triggering retrospectivity concerns...." (Brenton v. Metabolife Internat., Inc. (2004) 116 Cal.App.4th 679, 690, 10 Cal.Rptr.3d 702.) Furthermore, legislative action "can effect a partial repeal of an existing statute." (Ibid.) "`The justification for this rule is that all statutory remedies are pursued with full realization that the legislature may abolish the right to recover at any time.'" (Governing Board, at p. 829, 135 Cal.Rptr. 526, 558 P.2d 1.) That common law principle has been codified in California, as follows: "Any statute may be repealed at any time, except when vested rights would be impaired. Persons acting under any statute act in contemplation of this power of repeal." (Gov.Code, § 9606.) The substance of the legislation determines whether it constitutes a repeal. (Southern Service Co., Ltd. v. Los Angeles (1940) 15 Cal.2d 1, 13, 97 P.2d 963.)
Applying the foregoing principle to the case at hand, we conclude that plaintiffs' cause of action was eliminated by defendant's ordinance. In reaching that conclusion, we consider four factors: the statutory nature of the plaintiffs' claim; the unvested nature of plaintiffs' claimed rights; the timing of the elimination of those rights; and the nature of the mechanism by which the right of action was eliminated.
Addressing the first factor, we observe that plaintiffs' claim is wholly statutory, arising as it does from defendant's asserted violation of the Solar Shade Control Act. Plaintiffs' claim is "a cause of action unknown at the common law ... created by statute...." (Department of Social Welfare v. Wingo (1946) 77 Cal.App.2d 316, 320, 175 P.2d 262.) It derives from special remedial legislation. (See Southern Service Co., Ltd. v. Los Angeles, supra, 15 Cal.2d at p. 12, 97 P.2d 963.) In other words, plaintiffs "possessed no right or remedy... which existed apart from the statute itself and which the legislature could not cut off by repeal." (Id. at p. 11, 97 P.2d 963 [right to tax refund or credit "is purely statutory"].)
We next consider whether the nature of plaintiffs' rights prevents abolition of their claim. Repeal of a remedial statute destroys a pending statutory action unless "vested or contractual rights have arisen under" the statute. (Department of Social Welfare v. Wingo, supra, 77 Cal.App.2d at p. 320, 175 P.2d 262; see Gov.Code, § 9606.) In this case, no such rights have arisen. As explained in the unpublished portion of the opinion, plaintiffs have no contractual rights against defendant. Nor do plaintiffs have any vested right in maintaining their statutory claim. "`No person has a vested right in an unenforced statutory penalty or forfeiture.'" (Department of Social Welfare, at p. 320, 175 P.2d 262. Accord, People v. One 1953 Buick (1962) 57 Cal.2d 358, 366, 19 Cal.Rptr. 488, 369 P.2d 16; Chapman v. Farr (1982) 132 Cal.App.3d 1021, 1024-1025, 183 Cal.Rptr. 606.) Until it is fully enforced, a statutory remedy is merely an "`inchoate, incomplete, and unperfected'" right, which is subject to legislative abolition. (People v. One 1953 Buick, supra, 57 Cal.2d at p. 365, 19 Cal.Rptr. 488, 369 P.2d 16.)
The third factor in determining whether a statutory claim has been extinguished is timing. Whenever the Legislature eliminates a statutory remedy "before a judgment becomes final," the legislative act "destroys the right of action." (Department of Social Welfare v. Wingo, supra, 77 Cal.App.2d at p. 320, 175 P.2d 262.) Repeal thus "wipes out the *495 cause of action unless the same has been merged into a final judgment." (Wolf v. Pacific Southwest etc. Corp. (1937) 10 Cal.2d 183, 185, 74 P.2d 263.) "If final relief has not been granted before the repeal goes into effect it cannot be granted afterwards, even if a judgment has been entered and the cause is pending on appeal." (Southern Service Co., Ltd. v. Los Angeles, supra, 15 Cal.2d at p. 12, 97 P.2d 963. See also, e.g., Chapman v. Farr, supra, 132 Cal.App.3d at pp. 1024-1025, 183 Cal.Rptr. 606.) Here, the statutory right that plaintiffs assert was eliminated in 2002, two years before they filed this suit.
Finally, we turn to the legislative mechanism by which the right of action is abolished. Typically, that mechanism is repeal or amendment of the remedial statute. (See, e.g., Brenton v. Metabolife Internat., Inc., supra, 116 Cal.App.4th at p. 690, 10 Cal.Rptr.3d 702.) But we know of no rule of law that limits the Legislature to those methods. To the contrary, as our high court has observed, even where "the words of the [] statute are not expressly words of repeal without a saving clause, ... the effect is the same in so far as the application of the principles is concerned when the legislature by apt expression has withdrawn the right and remedy in particular cases, including all pending actions based thereon." (Southern Service Co., Ltd. v. Los Angeles, supra, 15 Cal.2d at p. 13, 97 P.2d 963.) The critical point is that "the legislature may take away the right of action itself." (Ibid.) Our high court thus has alluded to the Legislature's "power to enact a statute which would cut off the right theretofore accorded the plaintiff...." (Id. at p. 12, 97 P.2d 963) It also has spoken of the Legislature's power to "withdraw" a statutory right or remedy. (See id. at pp. 11, 12, 97 P.2d 963; International etc. Workers v. Landowitz (1942) 20 Cal.2d 418, 421, 126 P.2d 609.) As noted above, we look to the substance of the legislation  not its label  to determine whether it operates as a repeal. (Southern Service Co., Ltd. v. Los Angeles, supra, 15 Cal.2d at p. 13, 97 P.2d 963.) The pivotal issue is whether the legislation constitutes "a substantial reversal of legislative policy" that represents "the adoption of an entirely new philosophy" vis-à-vis the prior enactment. (People v. One 1953 Buick, supra, 57 Cal.2d at p. 363, 19 Cal.Rptr. 488, 369 P.2d 16.)
In this case, we conclude, the statutory right of action was eliminated by the exemption provision, which operated as a valid repeal method. Here, at the very time that the Legislature created the statutory right of action under the Solar Shade Control Act, it expressly empowered cities and counties to foreclose such actions against them. In this case, once defendant exercised that power, plaintiffs' statutory cause of action was abolished. Just as surely as if the Legislature had repealed the Solar Shade Control Act in its entirety, the "statutory authority for [plaintiffs'] action ... has now been withdrawn." (International etc. Workers v. Landowitz, supra, 20 Cal.2d at p. 421, 126 P.2d 609 [right to enjoin violation of ordinance was lost upon repeal of the enabling statutes].) Put another way, "the legislature by apt expression has withdrawn the right and remedy" that otherwise would be available to plaintiffs under the Solar Shade Control Act. (Southern Service Co., Ltd. v. Los Angeles, supra, 15 Cal.2d at p. 13, 97 P.2d 963.) That legislative choice embodies "a substantial reversal of [the] legislative policy" that underpins the remainder of the Act and "an entirely new philosophy" concerning its mandatory application to local jurisdictions. (People v. One 1953 Buick, supra, 57 Cal.2d at p. 363, *496 19 Cal.Rptr. 488, 369 P.2d 16.) In short, we conclude, the exemption provision  put in place by the Legislature and adopted by defendant  is a valid mechanism for extinguishing a statutory claim under the Solar Shade Control Act.
To sum up, plaintiffs' statutory cause of action is abolished. Plaintiffs enjoyed no vested rights in this statutory claim, which was unknown at common law, and which was not pursued to final judgment before its elimination by defendant's use of the exemption provision. That exemption operated as a form of repeal when defendant adopted it, extinguishing plaintiffs' statutory right of action. Because the mechanism of repeal was authorized by the Legislature, the elimination of plaintiffs' claim under these circumstances does not implicate retrospectivity concerns.


Fourth Cause of Action: Trespass[***]

CONCLUSION[***]

DISPOSITION
Treating the trial court's order as incorporating a judgment of dismissal, we affirm.
BAMATTRE-MANOUKIAN, Acting P.J., and MIHARA, J., concur.
NOTES
[*]  All portions of the opinion shall be published, with these exceptions: (a) the discussion of the first, second, fourth, fifth, and sixth causes of action, which appears under the heading "ANALYSIS" and (b) the paragraph that appears under the heading "CONCLUSION".
[1]  Because this case comes to us following a demurrer, we take the facts from plaintiffs' first amended complaint, the operative pleading. (See Gu v. BMW of North America, LLC (2005) 132 Cal.App.4th 195, 33 Cal.Rptr.3d 617.)
[**]  See footnote *, ante.
[3]  In this section of the opinion, which discusses plaintiffs' third cause of action, further unspecified statutory references are to the Public Resources Code.
[4]  A review of the chronology of pertinent events will be helpful to an understanding of the parties' contentions. In 1979, the Solar Shade Control Act took effect. (§ 25982.) In 1984-1985, plaintiffs built their solar home with county permits. In 1991, defendant acquired the adjoining parcel of land, with the trees already on it, and it placed that land in a Parks Reserve. In 1997, plaintiffs' solar system began to fail. In 2002, defendant adopted an ordinance exempting itself from the Solar Shade Control Act. In 2004, plaintiffs filed this action.
[***]  See footnote *, ante.
