Community
Participate
Working Groups
Passing single quotes as part of an annotation string value doesn't work as expected as the quote is escaped. This code in the annotation processor: addAnnotation(Value.newAnnotationReference [ setStringValue("value", "#{@'myBean'}") ])) leads to this generated annotation: @Value(value = "#{@\'myBean\'}") The expected result is: @Value(value = "#{@'myBean'}")
The generated Xtend code of the annotation processor class contains it.setStringValue("value", "#{@\'myBean\'}"); which is normal xtend behaviour so the same problem can be reproduced with a normal inferrer as well members += entity.toToStringMethod(it) => [ m | m.annotations += SuppressWarnings.annotationRef() => [ a | a.explicitValues += TypesFactory.eINSTANCE.createJvmStringAnnotationValue => [ operation = a.annotation.members.filter[simpleName=='value'].head as JvmOperation values += "'Hello'" ] ] ] => The Question is: why do we escape the ' in the first place org.eclipse.xtext.util.Strings.convertToJavaString(String, boolean) imho the escaping is a null op.
cc @sven