Skip to content

Migrate SVGRect to lambda-based ClassDescriptor (getter + setter)#1131

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/analyze-classdescriptor-implementation
Draft

Migrate SVGRect to lambda-based ClassDescriptor (getter + setter)#1131
Copilot wants to merge 2 commits into
masterfrom
copilot/analyze-classdescriptor-implementation

Conversation

Copy link
Copy Markdown

Copilot AI commented May 31, 2026

Continues the incremental migration from @JsxClass/@JsxGetter/@JsxSetter annotations to Rhino's ClassDescriptor API. SVGRect is the first migrated class to exercise both getter and setter lambdas via withProp.

Changes

  • SVGRect.java — Replaced all @Jsx* annotations with a static HTMLUNIT_DESCRIPTOR. All four properties (x, y, width, height) are wired as mutable accessor pairs:
.withProp(ClassDescriptor.Destination.PROTO, "x",
        (ScriptableObject.LambdaGetterFunction) thisObj ->
                ((SVGRect) thisObj).getX(),
        (ScriptableObject.LambdaSetterFunction) (owner, value) ->
                ((SVGRect) owner).setX(JavaScriptEngine.toNumber(value)),
        ScriptableObject.DONTENUM)
  • JavaScriptConfiguration.java — Moves SVGRect from getClasses() (annotation path) to getDescriptors() (descriptor path).

Migration progression

Class Properties Writable Pattern
BarProp, Gamepad, GamepadButton 0 Stub
GeolocationCoordinates 3 No Getter lambda only (DONTENUM | READONLY)
SVGRect 4 Yes Getter + setter lambda (DONTENUM)

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants