Skip to content

Fix error for indy string concat with a non-String return type - #14534

Closed
Maran23 wants to merge 2 commits into
oracle:masterfrom
Maran23:error-compiling-tostring
Closed

Maran23 wants to merge 2 commits into
oracle:masterfrom
Maran23:error-compiling-tostring

Conversation

@Maran23

@Maran23 Maran23 commented Sep 26, 2026 •

Copy link
Copy Markdown

Summary

For an assignment to a non-String variable, such as Object v = "a"; v += "b";, javac emits an indy string concatenation whose call type returns Object.
The GraalVM OutlineIndyStringConcatPlugin copied that return type.
Then in OutlinedSBMethod.buildGraph, due to Object, the method when into SubstrateSBConcatFactory instead and the image build failed.
(With should not reach here: unexpected input could not be handled: class java.lang.Object).

The return type is now always String, as a string concatenation always produces a String.
Then, the code will instead go to the SubstrateStringConcatFactory, which is correct and will work correctly.

Related Issues

Fixes: #14533

Testing

  • Tested with my reproducer in the issue
  • Wrote a test which confirms the fix

Documentation

  • No documentation update needed. Wrote a javadoc comment in the test.

Contributor Checklist

  • I have read the contribution guide.
  • I have the right to contribute the submitted material under the project terms.
  • I have updated tests and documentation where appropriate.
  • If I used a coding assistant, I remain responsible for the entire contribution and have reviewed it accordingly.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 26, 2026
@Maran23

Maran23 commented Sep 28, 2026

Copy link
Copy Markdown
Author

Fixed in #14545 -- as mentioned in #14533, so closing.

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

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GR-80008] Error when compiling a toString method: failed building outlined SB method

1 participant