Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Allow use of a Groovy compiler flag to enable type checking for all classes and methods except for the classes and methods annotated with a @TypeUnchecked annotation (or another antonym of @TypeChecked such as @NotTypeChecked or @RuntimeTypeChecked or @TestInProduction or @YouNeedExtraUnitTestsForThis)
For large projects with hundreds of classes, where we want type checking on 99% of the code, it would be too much boilerplate to remember to put @TypeChecked annotations on every class. It would also require us to refactor methods containing dynamic code into separate non-type-checked classes just to satisfy the @TypeChecked contract. It would be better to have a compiler flag to reverse the type checking contract so everything is type checked except for the classes and methods that are explicitly marked for allowing dynamic code.
Discussed with Guillaume Laforge after his talk about Groovy 2.0 at GR8Conf 2012 in Copenhagen. He agreed it would be a good addition for Groovy 2.1, and that I should open a Jira ticket. Another audience member had the same request as well.
Attachments
Issue Links
- depends upon
-
GROOVY-5553 Provide a builder for compilation customizers
- Closed
-
GROOVY-5554 AST customizer working as a guard for another
- Closed
- is duplicated by
-
GROOVY-5563 Option to default to Static Compilation
- Closed