Skip to content

Instantly share code, notes, and snippets.

@jesperronn
Created September 16, 2011 19:52
Show Gist options
  • Select an option

  • Save jesperronn/1222965 to your computer and use it in GitHub Desktop.

Select an option

Save jesperronn/1222965 to your computer and use it in GitHub Desktop.
WTF.java
package dk.justaddwater.wtf
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by IntelliJ IDEA.
* User: Jesper Rønn-Jensen
* Date: 16/09/11
* <p/>
* None functional WTF annotation to amuse developers
* <p/>
* Usage: Annotate hard-to-understand code with the @WTF annotation
* <p/>
* <p>The <code>WTF</code> annotation supports two optional parameters.
*
* The first, <code>explain</code>, and write why you dont understand this annotated element
*
* The second, <code>explanation</code>, is to explain why and how the element should be used
*
* NOTE that explanation element is DEPRECATED and considered bad style to use, since you are supposed to change
* the code to something better and more readable!
*
*
*/
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE})
public @interface WTF {
/**
* Optionally specify <code>explain</code>, and write why you dont understand this annotated element
*/
String explain() default "";
/**
* Optionally add <code>explanation</code>, and to explain why and how the element should be used
*/
@Deprecated
String explanation() default "";
}
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE})
public @interface WTF {
/**
* Optionally specify <code>explain</code>, and write why you dont understand this annotated element
*/
String explain() default "";
/**
* Optionally add <code>explanation</code>, and to explain why and how the element should be used
*/
@Deprecated
String explanation() default "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment