mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 02:16:18 +00:00
Switched all use of <code></code> in javadoc to {@code}.
This commit is contained in:
1 parent
b5c8b72565
commit
2d3b98e847
37 files changed
+100
-100
No files matched your search
@@ -37,10 +37,10 @@ import java.lang.annotation.Target;
|
||||
* while the generated hashCode and equals take into account all non-transient fields.<br>
|
||||
* Static fields are skipped (no getter or setter, and they are not included in toString, equals, hashCode, or the constructor).
|
||||
* <p>
|
||||
* <code>toString</code>, <code>equals</code>, and <code>hashCode</code> use the deepX variants in the
|
||||
* <code>java.util.Arrays</code> utility class. Therefore, if your class has arrays that contain themselves,
|
||||
* these methods will just loop endlessly until the inevitable <code>StackOverflowError</code>. This behaviour
|
||||
* is no different from <code>java.util.ArrayList</code>, though.
|
||||
* {@code toString}, {@code equals}, and {@code hashCode} use the deepX variants in the
|
||||
* {@code java.util.Arrays} utility class. Therefore, if your class has arrays that contain themselves,
|
||||
* these methods will just loop endlessly until the inevitable {@code StackOverflowError}. This behaviour
|
||||
* is no different from {@code java.util.ArrayList}, though.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
|
||||
@@ -27,29 +27,29 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Generates implementations for the <code>equals</code> and <code>hashCode</code> methods inherited by all objects.
|
||||
* Generates implementations for the {@code equals} and {@code hashCode} methods inherited by all objects.
|
||||
* <p>
|
||||
* If either method already exists, then <code>@EqualsAndHashCode</code> will not generate that particular method.
|
||||
* If they all exist, <code>@EqualsAndHashCode</code> generates no methods, and emits a warning instead to highlight
|
||||
* If either method already exists, then {@code @EqualsAndHashCode} will not generate that particular method.
|
||||
* If they all exist, {@code @EqualsAndHashCode} generates no methods, and emits a warning instead to highlight
|
||||
* that its doing nothing at all. The parameter list and return type are not relevant when deciding to skip generation of
|
||||
* a method; any method named <code>hashCode</code> will make <code>@EqualsAndHashCode</code> not generate that method,
|
||||
* a method; any method named {@code hashCode} will make {@code @EqualsAndHashCode} not generate that method,
|
||||
* for example.
|
||||
* <p>
|
||||
* By default, all fields that are non-static and non-transient are used in the equality check and hashCode generation.
|
||||
* You can exclude more fields by specifying them in the <code>exclude</code> parameter. You can also explicitly specify
|
||||
* the fields that are to be used by specifying them in the <code>of</code> parameter.
|
||||
* You can exclude more fields by specifying them in the {@code exclude} parameter. You can also explicitly specify
|
||||
* the fields that are to be used by specifying them in the {@code of} parameter.
|
||||
* <p>
|
||||
* Normally, auto-generating <code>hashCode</code> and <code>equals</code> implementations in a subclass is a bad idea, as
|
||||
* Normally, auto-generating {@code hashCode} and {@code equals} implementations in a subclass is a bad idea, as
|
||||
* the superclass also defines fields, for which equality checks/hashcodes won't be auto-generated. Therefore, a warning
|
||||
* is emitted when you try. Instead, you can set the <code>callSuper</code> parameter to <em>true</em> which will call
|
||||
* <code>super.equals</code> and <code>super.hashCode</code>. Doing this with <code>java.lang.Object</code> as superclass is
|
||||
* is emitted when you try. Instead, you can set the {@code callSuper} parameter to <em>true</em> which will call
|
||||
* {@code super.equals} and {@code super.hashCode}. Doing this with {@code java.lang.Object} as superclass is
|
||||
* pointless, so, conversely, setting this flag when <em>NOT</em> extending something (other than Object) will also generate
|
||||
* a warning. Be aware that not all implementations of <code>equals</code> correctly handle being called from a subclass!
|
||||
* Fortunately, lombok-generated <code>equals</code> implementations do correctly handle it.
|
||||
* a warning. Be aware that not all implementations of {@code equals} correctly handle being called from a subclass!
|
||||
* Fortunately, lombok-generated {@code equals} implementations do correctly handle it.
|
||||
* <p>
|
||||
* Array fields are handled by way of {@link java.util.Arrays#deepEquals(Object[], Object[])} where necessary, as well
|
||||
* as <code>deepHashCode</code>. The downside is that arrays with circular references (arrays that contain themselves,
|
||||
* possibly indirectly) results in calls to <code>hashCode</code> and <code>equals</code> throwing a
|
||||
* as {@code deepHashCode}. The downside is that arrays with circular references (arrays that contain themselves,
|
||||
* possibly indirectly) results in calls to {@code hashCode} and {@code equals} throwing a
|
||||
* {@link java.lang.StackOverflowError}. However, the implementations for java's own {@link java.util.ArrayList} suffer
|
||||
* from the same flaw.
|
||||
*/
|
||||
@@ -58,7 +58,7 @@ import java.lang.annotation.Target;
|
||||
public @interface EqualsAndHashCode {
|
||||
/**
|
||||
* Any fields listed here will not be taken into account in the generated
|
||||
* <code>equals</code> and <code>hashCode</code> implementations.
|
||||
* {@code equals} and {@code hashCode} implementations.
|
||||
* Mutually exclusive with {@link #of()}.
|
||||
*/
|
||||
String[] exclude() default {};
|
||||
@@ -72,7 +72,7 @@ public @interface EqualsAndHashCode {
|
||||
String[] of() default {};
|
||||
|
||||
/**
|
||||
* Call on the superclass's implementations of <code>equals</code> and <code>hashCode</code> before calculating
|
||||
* Call on the superclass's implementations of {@code equals} and {@code hashCode} before calculating
|
||||
* for the fields in this class.
|
||||
* <strong>default: false</strong>
|
||||
*/
|
||||
|
||||
@@ -42,10 +42,10 @@ import java.lang.annotation.Target;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Note that fields of type <code>boolean</code> (but not <code>java.lang.Boolean</code>) will result in an
|
||||
* <code>isFoo</code> name instead of <code>getFoo</code>.
|
||||
* Note that fields of type {@code boolean} (but not {@code java.lang.Boolean}) will result in an
|
||||
* {@code isFoo} name instead of {@code getFoo}.
|
||||
* <p>
|
||||
* If any method named <code>getFoo</code>/<code>isFoo</code> exists, regardless of return type or parameters, no method is generated,
|
||||
* If any method named {@code getFoo}/{@code isFoo} exists, regardless of return type or parameters, no method is generated,
|
||||
* and instead a compiler warning is emitted.
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
|
||||
@@ -39,9 +39,9 @@ public class Lombok {
|
||||
* about the concept of a 'checked exception'. All this method does is hide the act of throwing a checked exception
|
||||
* from the java compiler.
|
||||
* <p>
|
||||
* Note that this method has a return type of <code>RuntimeException</code> it is advised you always call this
|
||||
* method as argument to the <code>throw</code> statement to avoid compiler errors regarding no return
|
||||
* statement and similar problems. This method won't of course return an actual <code>RuntimeException</code> -
|
||||
* Note that this method has a return type of {@code RuntimeException} it is advised you always call this
|
||||
* method as argument to the {@code throw} statement to avoid compiler errors regarding no return
|
||||
* statement and similar problems. This method won't of course return an actual {@code RuntimeException} -
|
||||
* it never returns, it always throws the provided exception.
|
||||
*
|
||||
* @param t The throwable to throw without requiring you to catch its type.
|
||||
|
||||
@@ -27,16 +27,16 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Lombok is smart enough to translate any annotation named <code>@NonNull</code> or <code>@NotNull</code> in any casing and
|
||||
* Lombok is smart enough to translate any annotation named {@code @NonNull} or {@code @NotNull} in any casing and
|
||||
* with any package name to the return type of generated getters and the parameter of generated setters and constructors,
|
||||
* as well as generate the appropriate null checks in the setter and constructor.
|
||||
*
|
||||
* You can use this annotation for the purpose, though you can also use JSR305's annotation, findbugs's, pmd's, or IDEA's, or just
|
||||
* about anyone elses. As long as it is named <code>@NonNull</code> or <code>@NotNull</code>.
|
||||
* about anyone elses. As long as it is named {@code @NonNull} or {@code @NotNull}.
|
||||
*
|
||||
* WARNING: If the java community ever does decide on supporting a single @NonNull annotation (for example via JSR305), then
|
||||
* WARNING: If the java community ever does decide on supporting a single {@code @NonNull} annotation (for example via JSR305), then
|
||||
* this annotation will <strong>be deleted</strong> from the lombok package. If the need to update an import statement scares
|
||||
* you, you should use your own annotation named <code>@NonNull</code> instead of this one.
|
||||
* you, you should use your own annotation named {@code @NonNull} instead of this one.
|
||||
*/
|
||||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.lang.annotation.Target;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* If any method named <code>setFoo</code> exists, regardless of return type or parameters, no method is generated,
|
||||
* If any method named {@code setFoo} exists, regardless of return type or parameters, no method is generated,
|
||||
* and instead a compiler warning is emitted.
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
|
||||
@@ -37,8 +37,8 @@ import java.lang.annotation.Target;
|
||||
* You should use this annotation ONLY in the following two cases:<ol>
|
||||
* <li>You are certain the listed exception can't actually ever happen, or only in vanishingly rare situations.
|
||||
* You don't try to catch OutOfMemoryError on every statement either. Examples:<br>
|
||||
* <code>IOException</code> in <code>ByteArrayOutputStream</code><br>
|
||||
* <code>UnsupportedEncodingException</code> in new String(byteArray, "UTF-8").</li>
|
||||
* {@code IOException} in {@code ByteArrayOutputStream}<br>
|
||||
* {@code UnsupportedEncodingException} in new String(byteArray, "UTF-8").</li>
|
||||
* <li>You know for certain the caller can handle the exception (for example, because the caller is
|
||||
* an app manager that will handle all throwables that fall out of your method the same way), but due
|
||||
* to interface restrictions you can't just add these exceptions to your 'throws' clause.
|
||||
@@ -58,8 +58,8 @@ import java.lang.annotation.Target;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <code>@SneakyThrows</code> without a parameter defaults to allowing <i>every</i> checked exception.
|
||||
* (The default is <code>Throwable.class</code>).
|
||||
* {@code @SneakyThrows} without a parameter defaults to allowing <i>every</i> checked exception.
|
||||
* (The default is {@code Throwable.class}).
|
||||
*
|
||||
* @see Lombok#sneakyThrow(Throwable)
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,8 @@ import java.lang.annotation.Target;
|
||||
* Object, so that other code not under your control doesn't meddle with your thread management by locking on
|
||||
* your own instance.
|
||||
* <p>
|
||||
* For non-static methods, a field named <code>$lock</code> is used, and for static methods,
|
||||
* <code>$LOCK</code> is used. These will be generated if needed and if they aren't already present. The contents
|
||||
* For non-static methods, a field named {@code $lock} is used, and for static methods,
|
||||
* {@code $LOCK} is used. These will be generated if needed and if they aren't already present. The contents
|
||||
* of the fields will be serializable.
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
|
||||
+12
-12
@@ -27,28 +27,28 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Generates an implementation for the <code>toString</code> method inherited by all objects.
|
||||
* Generates an implementation for the {@code toString} method inherited by all objects.
|
||||
* <p>
|
||||
* If the method already exists, then <code>@ToString</code> will not generate any method, and instead warns
|
||||
* If the method already exists, then {@code ToString} will not generate any method, and instead warns
|
||||
* that it's doing nothing at all. The parameter list and return type are not relevant when deciding to skip generation of
|
||||
* the method; any method named <code>toString</code> will make <code>@ToString</code> not generate anything.
|
||||
* the method; any method named {@code toString} will make {@code ToString} not generate anything.
|
||||
* <p>
|
||||
* By default, all fields that are non-static are used in the toString generation. You can exclude fields by specifying them
|
||||
* in the <code>exclude</code> parameter. You can also explicitly specify the fields that
|
||||
* are to be used by specifying them in the <code>of</code> parameter.
|
||||
* in the {@code exclude} parameter. You can also explicitly specify the fields that
|
||||
* are to be used by specifying them in the {@code of} parameter.
|
||||
* <p>
|
||||
* Array fields are handled by way of {@link java.util.Arrays#deepToString(Object[])} where necessary.
|
||||
* The downside is that arrays with circular references (arrays that contain themselves,
|
||||
* possibly indirectly) results in calls to <code>toString</code> throwing a
|
||||
* possibly indirectly) results in calls to {@code toString} throwing a
|
||||
* {@link java.lang.StackOverflowError}. However, the implementations for java's own {@link java.util.ArrayList} suffer
|
||||
* from the same flaw.
|
||||
* <p>
|
||||
* The <code>toString</code> method that is generated will print the class name as well as each field (both the name
|
||||
* The {@code toString} method that is generated will print the class name as well as each field (both the name
|
||||
* and the value). You can optionally choose to suppress the printing of the field name, by setting the
|
||||
* <code>includeFieldNames</code> flag to <em>false</em>.
|
||||
* {@code includeFieldNames} flag to <em>false</em>.
|
||||
* <p>
|
||||
* You can also choose to include the result of <code>toString</code> in your class's superclass by setting the
|
||||
* <code>callSuper</code> to <em>true</em>.
|
||||
* You can also choose to include the result of {@code toString} in your class's superclass by setting the
|
||||
* {@code callSuper} to <em>true</em>.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@@ -60,7 +60,7 @@ public @interface ToString {
|
||||
boolean includeFieldNames() default true;
|
||||
|
||||
/**
|
||||
* Any fields listed here will not be printed in the generated <code>toString</code> implementation.
|
||||
* Any fields listed here will not be printed in the generated {@code toString} implementation.
|
||||
* Mutually exclusive with {@link #of()}.
|
||||
*/
|
||||
String[] exclude() default {};
|
||||
@@ -74,7 +74,7 @@ public @interface ToString {
|
||||
String[] of() default {};
|
||||
|
||||
/**
|
||||
* Include the result of the superclass's implementation of <code>toString</code> in the output.
|
||||
* Include the result of the superclass's implementation of {@code toString} in the output.
|
||||
* <strong>default: false</strong>
|
||||
*/
|
||||
boolean callSuper() default false;
|
||||
|
||||
@@ -41,7 +41,7 @@ import lombok.Lombok;
|
||||
* The java core libraries have a SPI discovery system, but it works only in Java 1.6 and up. For at least Eclipse,
|
||||
* lombok actually works in java 1.5, so we've rolled our own SPI discovery system.
|
||||
*
|
||||
* It is not API compatible with <code>ServiceLoader</code>.
|
||||
* It is not API compatible with {@code ServiceLoader}.
|
||||
*
|
||||
* @see java.util.ServiceLoader
|
||||
*/
|
||||
@@ -57,7 +57,7 @@ public class SpiLoadUtil {
|
||||
* Like ServiceLoader, each listed class is turned into an instance by calling the public no-args constructor.
|
||||
*
|
||||
* Convenience method that calls the more elaborate {@link #findServices(Class, ClassLoader)} method with
|
||||
* this {@link java.lang.Thread}'s context class loader as <code>ClassLoader</code>.
|
||||
* this {@link java.lang.Thread}'s context class loader as {@code ClassLoader}.
|
||||
*
|
||||
* @param target class to find implementations for.
|
||||
*/
|
||||
@@ -129,7 +129,7 @@ public class SpiLoadUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will find the <code>T</code> in <code>public class Foo extends BaseType<T>.
|
||||
* This method will find the @{code T} in {@code public class Foo extends BaseType<T>}.
|
||||
*
|
||||
* It returns an annotation type because it is used exclusively to figure out which annotations are
|
||||
* being handled by {@link lombok.eclipse.EclipseAnnotationHandler} and {@link lombok.javac.JavacAnnotationHandler}.
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TransformationsUtil {
|
||||
*
|
||||
* Strategy:
|
||||
*
|
||||
* First, pick a prefix. 'get' normally, but 'is' if <code>isBoolean</code> is true.
|
||||
* First, pick a prefix. 'get' normally, but 'is' if {@code isBoolean} is true.
|
||||
*
|
||||
* Then, check if the first character of the field is lowercase. If so, check if the second character
|
||||
* exists and is title or upper case. If so, uppercase the first character. If not, titlecase the first character.
|
||||
@@ -59,7 +59,7 @@ public class TransformationsUtil {
|
||||
* any prefix.
|
||||
*
|
||||
* @param fieldName the name of the field.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide <code>false</code>.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
|
||||
*/
|
||||
public static String toGetterName(CharSequence fieldName, boolean isBoolean) {
|
||||
final String prefix = isBoolean ? "is" : "get";
|
||||
|
||||
@@ -28,11 +28,11 @@ import lombok.core.AnnotationValues;
|
||||
*
|
||||
* You MUST replace 'T' with a specific annotation type, such as:
|
||||
*
|
||||
* <code>public class HandleGetter implements EclipseAnnotationHandler<<b>Getter</b>></code>
|
||||
* {@code public class HandleGetter implements EclipseAnnotationHandler<Getter>}
|
||||
*
|
||||
* Because this generics parameter is inspected to figure out which class you're interested in.
|
||||
*
|
||||
* You also need to register yourself via SPI discovery as being an implementation of <code>EclipseAnnotationHandler</code>.
|
||||
* You also need to register yourself via SPI discovery as being an implementation of {@code EclipseAnnotationHandler}.
|
||||
*/
|
||||
public interface EclipseAnnotationHandler<T extends java.lang.annotation.Annotation> {
|
||||
/**
|
||||
@@ -47,8 +47,8 @@ public interface EclipseAnnotationHandler<T extends java.lang.annotation.Annotat
|
||||
* @param annotationNode The Lombok AST wrapper around the 'ast' parameter. You can use this object
|
||||
* to travel back up the chain (something javac AST can't do) to the parent of the annotation, as well
|
||||
* as access useful methods such as generating warnings or errors focused on the annotation.
|
||||
* @return <code>true</code> if you don't want to be called again about this annotation during this
|
||||
* compile session (you've handled it), or <code>false</code> to indicate you aren't done yet.
|
||||
* @return {@code true} if you don't want to be called again about this annotation during this
|
||||
* compile session (you've handled it), or {@code false} to indicate you aren't done yet.
|
||||
*/
|
||||
boolean handle(AnnotationValues<T> annotation, org.eclipse.jdt.internal.compiler.ast.Annotation ast, EclipseNode annotationNode);
|
||||
}
|
||||
@@ -131,11 +131,11 @@ public class HandlerLibrary {
|
||||
* instance of {@link AnnotationValues}.
|
||||
*
|
||||
* Note that depending on the printASTOnly flag, the {@link lombok.core.PrintAST} annotation
|
||||
* will either be silently skipped, or everything that isn't <code>PrintAST</code> will be skipped.
|
||||
* will either be silently skipped, or everything that isn't {@code PrintAST} will be skipped.
|
||||
*
|
||||
* The HandlerLibrary will attempt to guess if the given annotation node represents a lombok annotation.
|
||||
* For example, if <code>lombok.*</code> is in the import list, then this method will guess that
|
||||
* <code>Getter</code> refers to <code>lombok.Getter</code>, presuming that {@link lombok.eclipse.handlers.HandleGetter}
|
||||
* For example, if {@code lombok.*} is in the import list, then this method will guess that
|
||||
* {@code Getter} refers to {@code lombok.Getter}, presuming that {@link lombok.eclipse.handlers.HandleGetter}
|
||||
* has been loaded.
|
||||
*
|
||||
* @param ast The Compilation Unit that contains the Annotation AST Node.
|
||||
@@ -184,7 +184,7 @@ public class HandlerLibrary {
|
||||
|
||||
/**
|
||||
* Lombok does not currently support triggering annotations in a specified order; the order is essentially
|
||||
* random right now. This lack of order is particularly annoying for the <code>PrintAST</code> annotation,
|
||||
* random right now. This lack of order is particularly annoying for the {@code PrintAST} annotation,
|
||||
* which is almost always intended to run last. Hence, this hack, which lets it in fact run last.
|
||||
*
|
||||
* @see #skipAllButPrintAST()
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.eclipse.jdt.internal.compiler.parser.Parser;
|
||||
* Note that, for any Method body, if Bit24 is set, the Eclipse parser has been patched to never attempt to
|
||||
* (re)parse it. You should set Bit24 on any MethodDeclaration object you inject into the AST:
|
||||
*
|
||||
* <code>methodDeclaration.bits |= ASTNode.Bit24; //0x800000</code>
|
||||
* {@code methodDeclaration.bits |= ASTNode.Bit24; //0x800000}
|
||||
*
|
||||
* @author rzwitserloot
|
||||
* @author rspilker
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.eclipse.jdt.internal.compiler.ast.TryStatement;
|
||||
import org.mangosdk.spi.ProviderFor;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Cleanup</code> annotation for eclipse.
|
||||
* Handles the {@code lombok.Cleanup} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
|
||||
|
||||
@@ -64,7 +64,7 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
|
||||
import org.mangosdk.spi.ProviderFor;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Data</code> annotation for eclipse.
|
||||
* Handles the {@code lombok.Data} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleData implements EclipseAnnotationHandler<Data> {
|
||||
|
||||
@@ -84,7 +84,7 @@ import lombok.eclipse.EclipseAnnotationHandler;
|
||||
import lombok.eclipse.EclipseNode;
|
||||
|
||||
/**
|
||||
* Handles the <code>EqualsAndHashCode</code> annotation for eclipse.
|
||||
* Handles the {@code EqualsAndHashCode} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleEqualsAndHashCode implements EclipseAnnotationHandler<EqualsAndHashCode> {
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
|
||||
import org.mangosdk.spi.ProviderFor;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Getter</code> annotation for eclipse.
|
||||
* Handles the {@code lombok.Getter} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleGetter implements EclipseAnnotationHandler<Getter> {
|
||||
@@ -57,7 +57,7 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> {
|
||||
*
|
||||
* The difference between this call and the handle method is as follows:
|
||||
*
|
||||
* If there is a <code>lombok.Getter</code> annotation on the field, it is used and the
|
||||
* If there is a {@code lombok.Getter} annotation on the field, it is used and the
|
||||
* same rules apply (e.g. warning if the method already exists, stated access level applies).
|
||||
* If not, the getter is still generated if it isn't already there, though there will not
|
||||
* be a warning if its already there. The default access level is used.
|
||||
|
||||
@@ -36,7 +36,7 @@ import lombok.eclipse.EclipseAnnotationHandler;
|
||||
import lombok.eclipse.EclipseNode;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.core.PrintAST</code> annotation for eclipse.
|
||||
* Handles the {@code lombok.core.PrintAST} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandlePrintAST implements EclipseAnnotationHandler<PrintAST> {
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
|
||||
import org.mangosdk.spi.ProviderFor;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Setter</code> annotation for eclipse.
|
||||
* Handles the {@code lombok.Setter} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleSetter implements EclipseAnnotationHandler<Setter> {
|
||||
@@ -64,7 +64,7 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> {
|
||||
*
|
||||
* The difference between this call and the handle method is as follows:
|
||||
*
|
||||
* If there is a <code>lombok.Setter</code> annotation on the field, it is used and the
|
||||
* If there is a {@code lombok.Setter} annotation on the field, it is used and the
|
||||
* same rules apply (e.g. warning if the method already exists, stated access level applies).
|
||||
* If not, the setter is still generated if it isn't already there, though there will not
|
||||
* be a warning if its already there. The default access level is used.
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.eclipse.jdt.internal.compiler.ast.TypeReference;
|
||||
import org.mangosdk.spi.ProviderFor;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.HandleSneakyThrows</code> annotation for eclipse.
|
||||
* Handles the {@code lombok.HandleSneakyThrows} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleSneakyThrows implements EclipseAnnotationHandler<SneakyThrows> {
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
|
||||
import org.mangosdk.spi.ProviderFor;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Synchronized</code> annotation for eclipse.
|
||||
* Handles the {@code lombok.Synchronized} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleSynchronized implements EclipseAnnotationHandler<Synchronized> {
|
||||
|
||||
@@ -64,7 +64,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
|
||||
import org.mangosdk.spi.ProviderFor;
|
||||
|
||||
/**
|
||||
* Handles the <code>ToString</code> annotation for eclipse.
|
||||
* Handles the {@code ToString} annotation for eclipse.
|
||||
*/
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleToString implements EclipseAnnotationHandler<ToString> {
|
||||
|
||||
@@ -155,11 +155,11 @@ public class HandlerLibrary {
|
||||
* instance of {@link lombok.core.AnnotationValues}.
|
||||
*
|
||||
* Note that depending on the printASTOnly flag, the {@link lombok.core.PrintAST} annotation
|
||||
* will either be silently skipped, or everything that isn't <code>PrintAST</code> will be skipped.
|
||||
* will either be silently skipped, or everything that isn't {@code PrintAST} will be skipped.
|
||||
*
|
||||
* The HandlerLibrary will attempt to guess if the given annotation node represents a lombok annotation.
|
||||
* For example, if <code>lombok.*</code> is in the import list, then this method will guess that
|
||||
* <code>Getter</code> refers to <code>lombok.Getter</code>, presuming that {@link lombok.javac.handlers.HandleGetter}
|
||||
* For example, if {@code lombok.*} is in the import list, then this method will guess that
|
||||
* {@code Getter} refers to {@code lombok.Getter}, presuming that {@link lombok.javac.handlers.HandleGetter}
|
||||
* has been loaded.
|
||||
*
|
||||
* @param unit The Compilation Unit that contains the Annotation AST Node.
|
||||
@@ -203,7 +203,7 @@ public class HandlerLibrary {
|
||||
|
||||
/**
|
||||
* Lombok does not currently support triggering annotations in a specified order; the order is essentially
|
||||
* random right now. This lack of order is particularly annoying for the <code>PrintAST</code> annotation,
|
||||
* random right now. This lack of order is particularly annoying for the {@code PrintAST} annotation,
|
||||
* which is almost always intended to run last. Hence, this hack, which lets it in fact run last.
|
||||
*
|
||||
* @see #skipAllButPrintAST()
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Javac {
|
||||
/**
|
||||
* Checks if the Annotation AST Node provided is likely to be an instance of the provided annotation type.
|
||||
*
|
||||
* @param type An actual annotation type, such as <code>lombok.Getter.class</code>.
|
||||
* @param type An actual annotation type, such as {@code lombok.Getter.class}.
|
||||
* @param node A Lombok AST node representing an annotation in source code.
|
||||
*/
|
||||
public static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node) {
|
||||
@@ -76,9 +76,9 @@ public class Javac {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of <code>AnnotationValues</code> for the provided AST Node.
|
||||
* Creates an instance of {@code AnnotationValues} for the provided AST Node.
|
||||
*
|
||||
* @param type An annotation class type, such as <code>lombok.Getter.class</code>.
|
||||
* @param type An annotation class type, such as {@code lombok.Getter.class}.
|
||||
* @param node A Lombok AST node representing an annotation in source code.
|
||||
*/
|
||||
public static <A extends Annotation> AnnotationValues<A> createAnnotation(Class<A> type, final JavacNode node) {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
* Creates a new JavacAST of the provided Compilation Unit.
|
||||
*
|
||||
* @param trees The trees instance to use to inspect the compilation unit. Generate via:
|
||||
* <code>Trees.getInstance(env)</code>
|
||||
* {@code Trees.getInstance(env)}
|
||||
* @param env The ProcessingEnvironment object passed e.g. to an annotation processor.
|
||||
* @param top The compilation unit, which serves as the top level node in the tree to be built.
|
||||
*/
|
||||
|
||||
@@ -32,11 +32,11 @@ import com.sun.tools.javac.tree.JCTree.JCAnnotation;
|
||||
*
|
||||
* You MUST replace 'T' with a specific annotation type, such as:
|
||||
*
|
||||
* <code>public class HandleGetter implements JavacAnnotationHandler<<b>Getter</b>></code>
|
||||
* {@code public class HandleGetter implements JavacAnnotationHandler<Getter>}
|
||||
*
|
||||
* Because this generics parameter is inspected to figure out which class you're interested in.
|
||||
*
|
||||
* You also need to register yourself via SPI discovery as being an implementation of <code>JavacAnnotationHandler</code>.
|
||||
* You also need to register yourself via SPI discovery as being an implementation of {@code JavacAnnotationHandler}.
|
||||
*/
|
||||
public interface JavacAnnotationHandler<T extends Annotation> {
|
||||
/**
|
||||
@@ -51,8 +51,8 @@ public interface JavacAnnotationHandler<T extends Annotation> {
|
||||
* @param annotationNode The Lombok AST wrapper around the 'ast' parameter. You can use this object
|
||||
* to travel back up the chain (something javac AST can't do) to the parent of the annotation, as well
|
||||
* as access useful methods such as generating warnings or errors focused on the annotation.
|
||||
* @return <code>true</code> if you don't want to be called again about this annotation during this
|
||||
* compile session (you've handled it), or <code>false</code> to indicate you aren't done yet.
|
||||
* @return {@code true} if you don't want to be called again about this annotation during this
|
||||
* compile session (you've handled it), or {@code false} to indicate you aren't done yet.
|
||||
*/
|
||||
boolean handle(AnnotationValues<T> annotation, JCAnnotation ast, JavacNode annotationNode);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Cleanup</code> annotation for javac.
|
||||
* Handles the {@code lombok.Cleanup} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleCleanup implements JavacAnnotationHandler<Cleanup> {
|
||||
|
||||
@@ -54,7 +54,7 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.util.List;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Data</code> annotation for javac.
|
||||
* Handles the {@code lombok.Data} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleData implements JavacAnnotationHandler<Data> {
|
||||
|
||||
@@ -54,7 +54,7 @@ import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.EqualsAndHashCode</code> annotation for javac.
|
||||
* Handles the {@code lombok.EqualsAndHashCode} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAndHashCode> {
|
||||
|
||||
@@ -47,7 +47,7 @@ import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Getter</code> annotation for javac.
|
||||
* Handles the {@code lombok.Getter} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleGetter implements JavacAnnotationHandler<Getter> {
|
||||
@@ -58,7 +58,7 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> {
|
||||
*
|
||||
* The difference between this call and the handle method is as follows:
|
||||
*
|
||||
* If there is a <code>lombok.Getter</code> annotation on the field, it is used and the
|
||||
* If there is a {@code lombok.Getter} annotation on the field, it is used and the
|
||||
* same rules apply (e.g. warning if the method already exists, stated access level applies).
|
||||
* If not, the getter is still generated if it isn't already there, though there will not
|
||||
* be a warning if its already there. The default access level is used.
|
||||
|
||||
@@ -37,7 +37,7 @@ import lombok.javac.JavacAnnotationHandler;
|
||||
import lombok.javac.JavacNode;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.core.PrintAST</code> annotation for javac.
|
||||
* Handles the {@code lombok.core.PrintAST} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandlePrintAST implements JavacAnnotationHandler<PrintAST> {
|
||||
|
||||
@@ -49,7 +49,7 @@ import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Setter</code> annotation for javac.
|
||||
* Handles the {@code lombok.Setter} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleSetter implements JavacAnnotationHandler<Setter> {
|
||||
@@ -60,7 +60,7 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
|
||||
*
|
||||
* The difference between this call and the handle method is as follows:
|
||||
*
|
||||
* If there is a <code>lombok.Setter</code> annotation on the field, it is used and the
|
||||
* If there is a {@code lombok.Setter} annotation on the field, it is used and the
|
||||
* same rules apply (e.g. warning if the method already exists, stated access level applies).
|
||||
* If not, the setter is still generated if it isn't already there, though there will not
|
||||
* be a warning if its already there. The default access level is used.
|
||||
|
||||
@@ -46,7 +46,7 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.util.List;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.SneakyThrows</code> annotation for javac.
|
||||
* Handles the {@code lombok.SneakyThrows} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleSneakyThrows implements JavacAnnotationHandler<SneakyThrows> {
|
||||
|
||||
@@ -43,7 +43,7 @@ import lombok.javac.JavacAnnotationHandler;
|
||||
import lombok.javac.JavacNode;
|
||||
|
||||
/**
|
||||
* Handles the <code>lombok.Synchronized</code> annotation for javac.
|
||||
* Handles the {@code lombok.Synchronized} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleSynchronized implements JavacAnnotationHandler<Synchronized> {
|
||||
|
||||
@@ -50,7 +50,7 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.util.List;
|
||||
|
||||
/**
|
||||
* Handles the <code>ToString</code> annotation for javac.
|
||||
* Handles the {@code ToString} annotation for javac.
|
||||
*/
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleToString implements JavacAnnotationHandler<ToString> {
|
||||
|
||||
@@ -169,7 +169,7 @@ class PKG {
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns an <code>AccessLevel<code> instance into the flag bit used by javac.
|
||||
* Turns an {@code AccessLevel} instance into the flag bit used by javac.
|
||||
*
|
||||
* @see java.lang.Modifier
|
||||
*/
|
||||
@@ -241,9 +241,9 @@ class PKG {
|
||||
}
|
||||
|
||||
/**
|
||||
* In javac, dotted access of any kind, from <code>java.lang.String</code> to <code>var.methodName</code>
|
||||
* is represented by a fold-left of <code>Select</code> nodes with the leftmost string represented by
|
||||
* a <code>Ident</code> node. This method generates such an expression.
|
||||
* In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName}
|
||||
* is represented by a fold-left of {@code Select} nodes with the leftmost string represented by
|
||||
* a {@code Ident} node. This method generates such an expression.
|
||||
*
|
||||
* For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]).
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user