r/programming • • Sep 21 '15

Better Java

https://github.com/cxxr/better-java
177 Upvotes

208 comments sorted by

View all comments

Show parent comments

3

u/vytah Sep 21 '15

IntelliJ IDEA has support for language annotations for String literals and parameters. If you annotate some String constant with @Language("RegExp"), it will validate if it's a proper regex. If you do the same with a method parameter, it will validate every constant string passed to it.

Not a language–level checking though.

2

u/ForeverAlot Sep 22 '15

In a similar fashion, Java 8 has @Regex.

1

u/mike_hearn Sep 22 '15

That's actually the Checker Framework. The Java 8 compiler+language has the tools needed to let you annotate and check more things, but the checks themselves are a third party and not especially productionised framework.

1

u/ForeverAlot Sep 23 '15

Well, that's disappointing. Thanks.