Caveat: what follows assumes that you find value in detecting syntax errors in the pre-"unit test" phase of development. That isn't to say that the most appropriate place to solve these issues isn't during unit testing, but I thought I'd throw the problem out to the group. If this is old ground & my search skills have failed me, feel free to point me at articles/posts/code.
I've been thinking about how to validate the stringly-typed[1] things I use (to greater or lesser degrees.) Within Java SE: - java.util.regex.Pattern - java.util.Formatter - java.text.MessageFormat - javax.xml.XPath - java.net.URI In the case where inputs to these types are static string constants their syntax can be validated at compile time via annotation processors. Expand into enterprise containers and you start encountering things like EL syntax. I've written some proof-of-concept code[2] that validates against the JRE implementation but such tests are unlikely to be consistent across JRE versions/implementations. What should they be validating against? Grammars? How do you specify the grammar given SPIs/JRE implementation bugs/etc? Runtime implementation? How do you handle things like XPath functions? I don't expect there'll be a catch-all answer; every DSL has different constraints; every project has its own needs. I'm just curious as to how other people are approaching these problems. [1] http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html [2] http://illegalargumentexception.blogspot.co.uk/2013/01/java-validating-regular-expression.html -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/javaposse?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
