
127 Ill.2d 486 (1989)
537 N.E.2d 800
THE PEOPLE OF THE STATE OF ILLINOIS, Appellee,
v.
ANGEL DEJESUS, Appellant.
No. 67641.
Supreme Court of Illinois.
Opinion filed March 29, 1989.
*487 *488 G. Joseph Weller, Deputy Defender, and Kim M. DeWitt, Assistant Defender, of the Office of the State Appellate Defender, of Elgin, for appellant.
Neil F. Hartigan, Attorney General, of Springfield (Robert J. Ruiz, Solicitor General, and Terence M. Madsen and William P. Pistorius, Assistant Attorneys General, of Chicago, of counsel), for the People.
Judgment vacated; cause remanded.
JUSTICE CALVO delivered the opinion of the court:
Angel DeJesus was charged by indictment in the circuit court of Lake County with first degree murder and armed robbery. The charge alleged that the offenses were committed with a knife. Although defendant was only 16 years old when charged, proceedings were instituted in criminal court pursuant to the "automatic transfer" provisions of section 2-7(6)(a) of the Juvenile Court Act (the Act) (Ill. Rev. Stat., 1987 Supp., ch. 37, par. 702-7(6)(a) (now Ill. Rev. Stat. 1987, ch. 37, par. 805-4(6)(a))). Section 2-7(6)(a) requires prosecution pursuant to the Criminal Code of 1961 (Ill. Rev. Stat. 1987, ch. 38, par. 1-1 et seq.) where a juvenile at least 15 years of age is charged with first degree murder, aggravated criminal sexual assault, armed robbery committed with a firearm, or violation of section 24-1(a)(12) of the Code. A jury subsequently acquitted DeJesus of the murder charge, but found her guilty of armed robbery. Since DeJesus *489 was not convicted of an offense listed in section 2-7(6)(a) of the Act, section 2-7(6)(c) requires that further proceedings be conducted under the Act, rather than the Unified Code of Corrections (Ill. Rev. Stat. 1987, ch. 38, par. 1001-1-1 et seq.).
Following DeJesus' trial, the State filed a motion to clarify the applicable law, a motion to continue sentencing hearing, and a motion to permit prosecution under the criminal laws. The chief judge of the circuit designated Juvenile Court Judge Barbara Gilleran-Johnson to hear and rule on the motions. The State argued that Judge William Block should hear the motions since he had presided over DeJesus' trial. The State informed the chief judge that it would ask Judge Block to rule on the "transfer petition" at a later date. The motions were heard before Judge Gilleran-Johnson on January 19, 1988.
The State, relying upon section 2-7(3) of the Act (Ill. Rev. Stat., 1987 Supp., ch. 37, par. 702-7(3)), argued that DeJesus could be sentenced as an adult, notwithstanding the legislative directives to the contrary in section 2-7(6)(c). Section 2-7(3) provides as follows:
"If a petition alleges commission by a minor 13 years of age or over of an act which constitutes a crime under the laws of this State, and, on motion of the State's Attorney, a Juvenile Judge, designated by the Chief Judge of the Circuit to hear and determine such motions, after investigation and hearing but before commencement of the adjudicatory hearing, finds that it is not in the best interests of the minor or of the public to proceed under this Act, the court may enter an order permitting prosecution under the criminal laws."
The State contended that, since no adjudicatory hearing under the Act had technically been held, the State could move to have DeJesus sentenced "under the criminal laws." The State noted that a former version of section *490 2-7(6)(c) (Ill. Rev. Stat. 1983, ch. 37, par. 702-7(6)(c)) had given the court discretion, where a juvenile was tried as an adult, to either sentence under chapter V of the Unified Code of Corrections or proceed to a dispositional hearing under article V of the Juvenile Court Act. The legislature has since amended the statute so that the court no longer has discretion. (Ill. Rev. Stat., 1987 Supp., ch. 37, par. 702-7(6)(c).) The State urged the court to hold that discretion to sentence a juvenile offender as an adult still implicitly exists under section 2-7(3), notwithstanding the directives of section 2-7(6)(c) that the court "must" proceed pursuant to the Juvenile Court Act where the juvenile is not convicted of one of the specified offenses in section 2-7(6)(a), but is nonetheless convicted of an offense.
The defense argued that an adjudicatory hearing had, in effect, taken place when DeJesus was found guilty of armed robbery; thus the State could not bring its contention within the purview of section 2-7(3). Moreover, the plain language of section 2-7(6)(c) required further proceedings to be conducted under the Act.
Judge Gilleran-Johnson found section 2-7(3) inapplicable because the State's motions had not been filed "before commencement of the adjudicatory hearing." (Ill. Rev. Stat., 1987 Supp., ch. 37, par. 702-7(3).) Since DeJesus had been adjudicated guilty of one of the charged offenses, the court ruled that an "adjudicatory hearing" within the meaning of section 2-7(3) had taken place and that a second adjudicatory hearing under the Act was barred by principles of double jeopardy. The court determined that further proceedings would be under the Juvenile Court Act pursuant to the plain language of section 2-7(6)(c) and dismissed the State's motion to permit prosecution under the criminal laws, advising the State that the order of dismissal was "final and appealable." *491 The matter was transferred to Judge Block for "disposition."
On January 22, 1988, the State filed a motion to declare section 2-7(6)(c) unconstitutional or, in the alternative, to interpret the statute as permissive. A petition to sentence DeJesus pursuant to the Unified Code of Corrections accompanied the State's motion. In its motion, the State argued the legislative mandate of section 2-7(6)(c) is unconstitutional in that it constitutes an invasion of the inherent powers of the judiciary. The defense moved to dismiss, arguing that Judge Gilleran-Johnson had already rejected the State's contention that it was within the court's discretion to proceed under the criminal laws and that the doctrine of res judicata therefore barred the State from pursuing, and the court entertaining, "other matters" which might have been raised before Judge Gilleran-Johnson. The defense claimed that the State was "seeking to accomplish, by attacking the constitutionality of section 2-7(6)(c), that which it was unable to accomplish through [its] petition/motion to permit prosecution under the criminal laws." The defense concluded that the State had waived its constitutional challenge when it failed to raise it before Judge Gilleran-Johnson. Pending motions were heard by Judge Block on February 11, 1988.
Before Judge Block, the defense raised Judge Gilleran-Johnson's prior ruling as a bar to Judge Block's consideration of the State's motions. The defense informed the court that the State's petition had requested DeJesus be sentenced pursuant to the criminal laws, and that request was denied. The State countered that the issues before Judge Gilleran-Johnson were juvenile matters on a juvenile petition. The State represented to Judge Block that the only matter decided by Judge Gilleran-Johnson was that the State could not file a petition to have DeJesus adjudicated a delinquent at that point in *492 time due to double jeopardy constraints. The State noted that the defense had not presented a transcript of proceedings before Judge Gilleran-Johnson and, without the transcripts, res judicata could not be demonstrated. The State then argued that section 2-7(6) could not divest the court of discretion to treat DeJesus as either a juvenile or an adult for purposes of disposition. The State remarked, "They [the legislature] can't give you jurisdiction over an adult criminal case, and then say that you can't do certain things as far as the way you handle the case in a sentencing hearing." The State contended that it had standing to raise due process and equal protection challenges to the statute as well: "We represent all of the people * * * and I think we have to make sure that the laws apply equally to everybody."
The court apparently agreed with this position, remarking that "the State represents Ms. DeJesus as well as every other person." The court continued, "I am offended by the incongruity, the illogic, the inconsistency, and the nonrelationship of this statute [section 2-7(6)] with the * * * rest of the Juvenile Court Act." When the defense again raised res judicata in the course of its argument, noting that the "same issue [had] already been decided by another judge in [the] circuit," Judge Block responded:
"No the only issue decided by the juvenile judge is the only issue that was sent. And that is whether or not the State had a right to a transfer hearing pursuant to the juvenile court act. And that's the only thing that that court, the juvenile court had jurisdiction on."
The court stated the juvenile judge had limited jurisdiction:
"As far as I understand the act, this is my case, this is my trial, this is assigned to me, I have general jurisdiction over all matters * * *.

*493 *   *   *
I don't care what she [Judge Gilleran-Johnson] ruled on. She didn't have jurisdiction to rule on those [motions] in my case."
The court rejected the defense's res judicata argument.
In announcing its ruling on the State's motions, the court expressed problems with the "jurisdictional" aspects of transfer, pursuant to the statute, to criminal court for trial and then back to juvenile court for disposition. The court purported to give deference to Judge Gilleran-Johnson's ruling while at the same time it proceeded to sentence DeJesus, pursuant to the Unified Code of Corrections, to 15 years in the Department of Corrections. In so ruling, Judge Block held that the language of section 2-7(6)(c) of the Juvenile Court Act is unconstitutionally vague. The instant appeal was taken from Judge Block's ruling pursuant to Supreme Court Rule 302(a) (107 Ill.2d R. 302(a)), which allows a direct appeal to this court when the circuit court has declared a statute invalid.
Our analysis begins with DeJesus' contention that the doctrine of res judicata barred Judge Block from sentencing DeJesus under the Unified Code of Corrections. The doctrine of res judicata is applicable where there is (1) a final judgment on the merits in an earlier action, (2) an identity of the cause of action in both an earlier and later suit, and (3) an identity of parties in the two suits. (Smith v. City of Chicago (7th Cir.1987), 820 F.2d 916; In re Marriage of Firestone (1987), 158 Ill. App.3d 887.) It is apparent that this case does not fit neatly into the framework of a res judicata analysis. However, to the extent that DeJesus has questioned Judge Block's reexamination of an issue ruled upon by Judge Gilleran-Johnson, she has identified the crucial issue in this case.
We believe the issue before us is whether Judge Block could, consistent with the effective administration of justice, *494 properly rule upon matters already determined by Judge Gilleran-Johnson. In this respect, we believe Judge Block's comments indicate that he was aware of the scope of Judge Gilleran-Johnson's ruling and either chose to ignore its breadth or dispute the judge's jurisdiction. We further find that the State's conduct evidences "judge shopping."
Whether Judge Block could, in effect, revise, vacate or ignore Judge Gilleran-Johnson's ruling depends upon whether that ruling was immediately appealable. This court has stated, in a variety of contexts, that an interlocutory order may be reviewed, modified or vacated under certain circumstances before final judgment, and it is of no consequence that the original order was entered by another circuit judge. (See Rowe v. State Bank (1988), 125 Ill.2d 203; Balciunas v. Duff (1983), 94 Ill.2d 176; Towns v. Yellow Cab Co. (1978), 73 Ill.2d 113.) Notwithstanding, we have cautioned that interlocutory rulings should be vacated or amended by another judge only after careful consideration, particularly where there is evidence of "judge shopping" by one who has received an adverse ruling. (Rowe, 125 Ill.2d at 214; Balciunas, 94 Ill.2d at 187-88; Towns, 73 Ill.2d at 121.) However, where a ruling is immediately appealable, an aggrieved party's remedy is to appeal, and the second judge should decline to act. (Balciunas, 94 Ill.2d at 183-84; People ex rel. Kelly, Ketting, Furth, Inc. v. Epstein (1974), 61 Ill.2d 229, 230-31; People ex rel. MacMillian v. Napoli (1966), 35 Ill.2d 80, 82.) We believe, in the context of this case, Judge Gilleran-Johnson's ruling was appealable, as it constituted a judicial pronouncement, based upon the plain language of the statute, that the criminal prosecution had terminated. Therefore, Judge Block should have declined to rule on the State's motions.
Supreme Court Rule 604(a)(1) (107 Ill.2d R. 604(a)(1)) governs the State's right to appeal in criminal cases. *495 Pursuant to Supreme Court Rule 660(a) (107 Ill.2d R. 660(a)), Rule 604(a)(1) also applies in juvenile delinquency proceedings. (In re Hershberger (1985), 132 Ill. App.3d 332.) Rule 604(a)(1) provides:
"the State may appeal only from an order or judgment the substantive effect of which results in dismissing a charge for any of the grounds enumerated in section 114-1 of the Code of Criminal Procedure of 1963; arresting judgment because of a defective indictment, information or complaint; quashing an arrest or search warrant; or suppressing evidence." (107 Ill.2d R. 604(a)(1).)
This court has held that the grounds enumerated in section 114-1 of the Code of Criminal Procedure of 1963 are not exclusive. (People v. Lawson (1977), 67 Ill.2d 449, 455; People v. Love (1968), 39 Ill.2d 436, 439-40.) The State retains the right to appeal in any case of a judgment the substantive effect of which results in dismissal of a charge. Rule 604(a)(1) was not intended to extinguish the State's right to appeal from a judgment the substantive effect of which was to dismiss charges on grounds not specified in the rule. Love, 39 Ill.2d at 439-40; People v. Martin (1977), 67 Ill.2d 462, 464-65.
In Martin, this court upheld the State's right to appeal from a circuit court order denying the State's motion to try Martin in criminal court. In Martin, the State had initially instituted delinquency proceedings against 16-year-old Bradley Martin, alleging that he had committed the criminal offense of reckless homicide. The State also sought to remove the proceeding to criminal court pursuant to section 2-7(3) of the Juvenile Court Act (Ill. Rev. Stat. 1975, ch. 37, par. 702-7(3)), which provides for discretionary prosecution under criminal laws. When the court denied the State's motion to prosecute Martin as an adult, the State appealed. The appellate court dismissed the appeal, ruling that the circuit court's action was not final and appealable. This court allowed the *496 State's petition for leave to appeal and ultimately concluded that an appeal pursuant to Rule 604(a)(1) was proper where "the substantive effect of the trial court's action * * * was the dismissal of any future indictment on the reckless homicide charge." (Martin, 67 Ill.2d at 465.) In Martin, there was apparently no indictment on file to be dismissed; however, this court looked beyond mere technicalities to the substantive effect of the circuit court's ruling which effectively prohibited the filing of criminal charges. Moreover, this court concluded "that the trial court's denial of a motion to remove ought not to be totally immunized from review." Martin, 67 Ill.2d at 466.
Implicit in the Martin decision is a recognition that the State has an appealable interest in pursuing a criminal prosecution, as opposed to delinquency proceedings. Since both criminal trials under the Code of Criminal Procedure and adjudicatory hearings under the Juvenile Court Act result in adjudications which are indistinguishable for purposes of double jeopardy (Breed v. Jones (1975), 421 U.S. 519, 44 L.Ed.2d 346, 95 S.Ct. 1779; People v. Taylor (1979), 76 Ill.2d 289), the State's interest in seeking prosecution under criminal laws must stem from the different dispositional alternatives available under the Unified Code of Corrections and the Juvenile Court Act. Thus, the State has a right to appeal so that it can pursue sentencing alternatives under the Unified Code of Corrections for the offense charged.
The appellate court recognized the State's interest in prosecuting its case to final judgment when it allowed appeals pursuant to Rule 604(a)(1) in People v. Oswald (1982), 106 Ill. App.3d 645, and more recently in People v. O'Mahoney (1988), 169 Ill. App.3d 194. In O'Mahoney, a defendant charged with felony and misdemeanor offenses under the Cannabis Control Act (Ill. Rev. Stat. 1985, ch. 56 1/2, pars. 704(e), 708) filed a "Motion for Advisement *497 and Election" seeking a ruling that she could elect which charge to be sentenced on in the event she was found guilty of both. The State moved to dismiss the misdemeanor charge, and the motion was granted over defendant's objection. The circuit court subsequently granted defendant's motion, ruling defendant would be allowed to elect whether to be punished for a felony or a misdemeanor in the event the evidence presented at trial proved her guilty of both the pending felony charge and the dismissed misdemeanor charge. In reversing the order of the circuit court, the appellate court recognized that the substantive effect of the ruling was to dismiss the felony charge inasmuch as it precluded the State from prosecuting the felony charge to final judgment. O'Mahoney, 169 Ill. App.3d at 199.
In O'Mahoney, as in Martin, no actual dismissal of the charging instrument occurred. In O'Mahoney, the information charging the felony offense remained intact and pending notwithstanding the circuit court's ruling; in Martin, no charging instrument had been filed. However, the "substantive effect" of the ruling of the circuit court in both instances was dismissal within the meaning of Rule 604(a)(1).
In the instant case, the State was aware that Judge Gilleran-Johnson's ruling effectively terminated the criminal prosecution. Although not dispositive of appellate rights (see E.J. De Paoli Co. v. Novus, Inc. (1987), 156 Ill. App.3d 796), Judge Gilleran-Johnson advised the State that her order was final and appealable. The State should have taken an appeal if it believed the ruling was incorrect. (Napoli, 35 Ill.2d at 81-82.) It is evident from a reading of the record that the State engaged in "judge shopping." The State argued before the chief judge that the motions in question should be heard by Judge Block, and advised the chief judge after assignment that it would raise the motions before Judge Block in any *498 event. The addition of a constitutional challenge in proceedings before Judge Block does not alter our conclusion that the same claim was presented before both judges. The constitutional challenge should have been presented to Judge Gilleran-Johnson and the failure to do so resulted in waiver. Constitutional questions are not excluded from the waiver rule (People v. Black (1972), 52 Ill.2d 544), which applies to the State as well as defendants (People v. McAdrian (1972), 52 Ill.2d 250, 254).
Contrary to Judge Block's pronouncements and reasoning, we find that Judge Gilleran-Johnson, who was assigned to rule on the matter in question by the chief judge, had jurisdiction to determine whether further proceedings would be under the Unified Code of Corrections or the Juvenile Court Act, and no question of criminal court or juvenile court jurisdiction was involved in that determination. The Illinois Constitution provides that all circuit courts have original jurisdiction over all justiciable matters with two exceptions not relevant here. (Ill. Const. 1970, art. VI, § 9.) Juvenile court is a division of a single unified circuit court. (In re Greene (1979), 76 Ill.2d 204, 213; People v. Jiles (1969), 43 Ill.2d 145, 147.) Whether a person is tried in juvenile or criminal court is merely a matter of procedure. (People v. Green (1982), 104 Ill. App.3d 278, 281.) Judge Gilleran-Johnson had jurisdiction to rule on the State's motion to sentence DeJesus under the criminal laws. Her order terminated the criminal prosecution prior to final judgment and was therefore appealable. Judge Block should have declined to act. The record sufficiently demonstrates that he was aware of the scope of the prior ruling and chose to limit its effect. We therefore vacate Judge Block's ruling and DeJesus' sentence as inconsistent with Judge Gilleran-Johnson's prior order.
Because of our disposition of this case, we cannot determine here whether the legislature has the power to *499 require a court to proceed under the Juvenile Court Act or criminal laws  an issue we addressed in People v. J.S. (1984), 103 Ill.2d 395, 402-06  or whether the legislature's ongoing revisions of this portion of the Juvenile Court Act have resulted in constitutional infirmities by reason of inconsistencies in the treatment and procedure under sections 2-7(3) and (6) of the Act. Constitutional questions will not be decided unnecessarily. Haughton v. Haughton (1979), 76 Ill.2d 439.
For the foregoing reasons, Judge Block's order striking down portions of section 2-7(6)(c) and his sentencing of DeJesus are vacated and the cause is remanded for further proceedings under the Juvenile Court Act.
Judgment vacated; cause remanded.
JUSTICE WARD took no part in the consideration or decision of this case.
