We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Any chance of adding an alternate character that can be used when specifying substitions ($T, $L, $S etc...)?
$T
$L
$S
$ is a real bummer to use from Kotlin.
$
Regular Strings are kinda bad:
addStatement( "CompletableFuture<\$T> future = getMemberNodeAsync(" + "\"\$L\", " + "\"$variableName\", " + "\$T.parse(\"\$L\"), " + "false" + ")", UaNode::class.java, variableTypeNodeNamespaceUri, ExpandedNodeId::class.java, referenceTypeId.expanded(namespaceTable).toParseableString() )
Multi-line Strings are even worse:
add( """ new ${'$'}T<>( "$namespaceUri", "$propertyName", ${'$'}T.parse("nsu=${'$'}L;${'$'}L"), ${'$'}T.${propertyNode.valueRank.toValueRanksFieldRef()}, ${'$'}T.class ) """.trimIndent(), QualifiedProperty::class.java, ExpandedNodeId::class.java, dataTypeNamespace, dataTypeIdString, ValueRanks::class.java, dataTypeClassName )
The text was updated successfully, but these errors were encountered:
Here's an easy workaround I've used in the past:
private const val T = "\$T"
Sorry, something went wrong.
This works but you need to be careful with type parameters in places you import those constants.
In particular, a reified type parameter T defined in any file where you've imported the constant will require its type parameter to be renamed:
T
inline fun <reified T> MethodSpec.Builder.addAnnotation(builderAction: AnnotationSpec.Builder.() -> Unit) { val clazz = T::class.java val annotationBuilder = AnnotationSpec.builder(clazz) builderAction(annotationBuilder) addAnnotation(annotationBuilder.build()) }
@kevinherron , you might want to check #761 (comment)
An alternative approach for Kotlin would be to apply JetPack Compose for building the AST.
No branches or pull requests
Any chance of adding an alternate character that can be used when specifying substitions (
$T
,$L
,$S
etc...)?$
is a real bummer to use from Kotlin.Regular Strings are kinda bad:
Multi-line Strings are even worse:
The text was updated successfully, but these errors were encountered: