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

Class cast exception when GStrings are used with System.getProperty #13569

Closed
sadheeshv opened this issue Jun 23, 2020 · 2 comments
Closed

Class cast exception when GStrings are used with System.getProperty #13569

sadheeshv opened this issue Jun 23, 2020 · 2 comments

Comments

@sadheeshv
Copy link

Summary:
GString substitution is now working. It works fine with Gradle 6.4.1 and earlier. But it break on Gradle 6.5

Steps to Reproduce
task bugFoo{
doLast {
String appCode = "XX"
println (":app-${appCode}:${System.getProperty('os.name', "${appCode}-gunit")}")
}
}

Expected Behavior
Should print ":app-XX:Mac OS X" without any exception

Current Behavior
It throws following error
"""* Where:
Build file '/Users/svenkatachalam/gw/lab/gosu-java-single-proj/build.gradle' line: 118

  • What went wrong:
    Execution failed for task ':bugFoo'.

org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String
"""

@big-guy
Copy link
Member

big-guy commented Jun 24, 2020

Thanks @sadheeshv - this looks real.

As a workaround, I think you can remove the extra layer of interpolation:

println (":app-${appCode}:${System.getProperty('os.name', "${appCode}-gunit")}")

becomes

println (":app-${appCode}:${System.getProperty('os.name', appCode+"-gunit")}")

@big-guy big-guy changed the title GString blows up with cast exception Class cast exception when GStrings are used with System.getProperty Jun 24, 2020
@adammurdoch adammurdoch self-assigned this Jun 24, 2020
@adammurdoch adammurdoch added this to the 6.6 RC1 milestone Jun 24, 2020
@adammurdoch
Copy link
Member

Fixed via #13585.

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

No branches or pull requests

6 participants