Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Compiler crash when using xml:map with an xml union type #42771

Closed
poorna2152 opened this issue May 17, 2024 · 3 comments · Fixed by #42810
Closed

[Bug]: Compiler crash when using xml:map with an xml union type #42771

poorna2152 opened this issue May 17, 2024 · 3 comments · Fixed by #42810
Assignees
Labels
Lang/XML XML design related issues Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Milestone

Comments

@poorna2152
Copy link
Contributor

Description

Consider the following code,

public function main() {
    xml<xml:Element>|xml<xml:Comment> x1 = xml `<a><b><c><e>foo</e></c></b><d><g>bar</g></d></a>`;
    xml x2 = <xml> x1;
    _ = xml:map(xml:elements(x2), v => xml:getChildren(v));
}

When run this program crashes with the following log,

[2024-05-17 15:01:15,937] SEVERE {b7a.log.crash} - _1 
java.lang.NoSuchFieldError: _1
        at poorna.xmlns_def.0.main.main(main.bal:183)
        at poorna.xmlns_def.0.$_init.$moduleExecute(xmlns_def)
        at poorna.xmlns_def.0.$_init.$lambda$$moduleExecute$(xmlns_def)
        at io.ballerina.runtime.internal.scheduling.SchedulerItem.execute(SchedulerItem.java:54)
        at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:320)
        at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:287)
        at java.base/java.lang.Thread.run(Thread.java:833)

Steps to Reproduce

No response

Affected Version(s)

2201.9.0

OS, DB, other environment details and versions

No response

Related area

-> Runtime

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@poorna2152 poorna2152 added Type/Bug Lang/XML XML design related issues labels May 17, 2024
@ballerina-bot ballerina-bot added the Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime label May 17, 2024
@Thushara-Piyasekara
Copy link
Contributor

Thushara-Piyasekara commented May 17, 2024

Following is a simplified version of the code snippet which produces the same error,

public function main() {
    xml:Element|xml:Text x1 = xml `<a></a>`;
    _ = xml:map(xml:elements(<xml>x1), v => xml:getChildren(v));
}

Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@poorna2152 poorna2152 added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label May 28, 2024
@poorna2152 poorna2152 added this to the 2201.9.1 milestone May 31, 2024
@poorna2152
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lang/XML XML design related issues Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants