Let Your Groovy Code Remember Your Sins

Vladimír Oraný
Stories by Agorapulse
2 min readJun 14, 2018

There are many situations when you write a code that makes you not particularly happy e.g. when you are under time pressure or it is supposed to be just a temporary solution like migration of the database or a April prank. You can add a TODO to revisit the code later but you know you will very likely never do it. For these situations there is @Remember annotation.

@Remember is an annotation which helps you not to forget any temporary solution (aka hacks or quick wins) you have introduced into your code base. You specify the date in the future when you want to revisit the code, e.g. @Remember('2018-04-02'). After this date the code no longer compiles forcing you to re-evaluate if the code is still required or to find more permanent solution.

There is an extended notation for @Remember:

import com.agorapulse.remember.Remember

@Remember(
value = '2019',
description = 'This method should be already removed',
format = 'yyyy'
)
class Subject { }

You can modify the format of the date value by setting format property of the annotation. You can customise the message being shown by using description property.

@Remember can be applied to any annotated element such as class, method or method parameter. You can add @Remember annotation to you project using jcenter:

repositories { jcenter() }
dependencies { compile 'com.agorapulse:remember:0.1' }

--

--