-
Notifications
You must be signed in to change notification settings - Fork 28
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
Backslashes in Patterns are doubled #9
Comments
If forget the necessary escaping, which regexp do you pursue? |
Thanks for responding so quickly! The regular expression I need is My goal is to generate an annotation that looks exactly like
with |
Plase try with single backslashes first. Just to make sure. On Mon, Jun 29, 2015 at 11:11 PM, Harald Albers notifications@github.com
|
The single backslash syntax, i.e.
is rejected due to parser errors. Here's the corresponding Maven stackdump:
|
Same error when used in Eclipse with m2e connector for jaxb2:
|
@highsource Just a ping. Will you be able to provide a fix for this soon? |
Sorry, I'm pretty under water at the moment. Would accept a PR though. |
No problem, thanks for the reply. Can you please give me a hint where I might look for potential problems? |
Hi, the problem is that a string which is used as an annotation parameter is So I'd first try to reproduce this in the level of the JCodeModel. Create a Best wishes, On Fri, Feb 19, 2016 at 1:28 PM, Harald Albers notifications@github.com
|
Hi, I've had a look at this issue. Yeah, the problem is that JAnnotationUse internally escapes So, on one hand we have a method, that escapes String internally and it seems that we have to pass there unescaped value. As a possible solution, we could forcely unescape parsed String before passing it to JAnnotationUse. Maybe just in this mentioned method https://github.com/highsource/jaxb2-annotate-plugin/blob/master/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingSingleValueVisitor.java#L128 |
@highsource Any chance that this issue could be resolved in the future? |
Hi everyone 😄 (@rosko01 / @albers / @digitalfog) |
Should this be fixed in |
Yes this should be fixed in with annotate v2.0.9 |
@albers : |
@laurentschoelens I only updated the maven plugin coordinates and was still using |
Cool 👍 |
@albers did you manage to get this fixed ? |
Yes, using the correct dependency, I had no more problems.
|
I'm trying to add a JSR-303
@Pattern
constraint to a generated class. The pattern contains backslashes.In the generated code, all backslashes are doubled:
"[0-9]+\\.[0-9]{1,2}\\.[0-9]{4}\\.[0-9]+"
->"[0-9]+\\\\.[0-9]{1,2}\\\\.[0-9]{4}\\\\.[0-9]+"
This happens when invoking from maven and from Eclipse using m2e connector for jaxb2
Resorting to single backslashes in the (xjb) source won't help as it produces parser errors.
XJB fragment:
Maven build section:
Is there any way to circumvent this behaviour?
The text was updated successfully, but these errors were encountered: