Repository navigation
Inherit the state sets and methods of the supertypes' specs - #16
Merged
Merged
Conversation
A class whose @stateset is in a superclass's spec, such as java.awt.Frame with the displayable states declared for java.awt.Window, had no state machine, and the superclass's machine did not have the subclass's methods. parseAll(List<String> uris, String className) builds one model from several files and merges the specs of the class's supertypes in them, as the verifier does when it builds a receiver's machine: the class's own state sets first, then those of its supertypes, nearest first. A call uses the class's own refinement of a method, otherwise that of the nearest type that declares it, so an inherited refinement is left out when a nearer spec refines the method, when a nearer type redeclares it, or when not every caller can call it. Constructors stay the class's own. parseAll(uri, className) does the same for the specs in one file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file that no longer exists made the model fail to build, which discarded the specs in the other files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needed for liquid-java/vscode-liquidjava#173: a state error on a method declared in a subclass's spec, with the state set in a superclass's spec, shows no usable diagram.
Why
parseAll(uri, className)read one type. Forjava.awt.Frame, whose@StateSetis in thejava.awt.Windowspec, it found no state set, so there was no diagram. TheWindowdiagram had nosetUndecorated.What
parseAll(List<String> uris, String className)builds one model from several files and merges the specs of the class's supertypes. It follows the rule the verifier uses for state hints since liquid-java/liquidjava#464 (StateMachineBuilder):supertypesOf. JDK classes resolve by reflection.StateErrorContextstates, sostateSetindexes match.FrameredeclaresaddNotify, so aWindowspec'saddNotifydoes not apply), orparseAll(uri, className)now calls it with one file. A file with only one type skips the hierarchy walk, so the editor's own-file diagrams are unchanged. Files that no longer exist are skipped.Issue example (
WindowandFramespecs, both in one file or in two),parseAll(..., "java.awt.Frame"):Initial:
new Frame(String)→ notDisplayable.addNotifyandWindow(Frame)from theWindowspec are left out.Tests
mvn test: 32 tests, 0 failures, run locally. New:testStateSetAndMethodsInheritedFromTheSuperclassSpec: one file, withaddNotifyleft out onFrameand kept onWindow.testSpecsInheritedFromOtherFiles: specs in two files; the subclass file alone still gives nothing.testOverriddenAndPackagePrivateInheritedMethods: source classes; the child's override replaces the parent's, and a package-private parent method is left out.testMethodsInheritedFromASpecWithoutStateSet:JFrameover a method-onlyFramespec andWindow's state set.testMissingFileDoesNotDiscardTheOthers: a file that no longer exists is skipped.Release
vscode-liquidjava needs this released as liquidjava-fsm 0.2.3. Its PR bumps to that version.
🤖 Generated with Claude Code