aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/AccessLevel.java31
-rw-r--r--src/core/lombok/Cleanup.java82
-rw-r--r--src/core/lombok/Data.java60
-rw-r--r--src/core/lombok/EqualsAndHashCode.java80
-rw-r--r--src/core/lombok/Getter.java58
-rw-r--r--src/core/lombok/Lombok.java60
-rw-r--r--src/core/lombok/NonNull.java43
-rw-r--r--src/core/lombok/Setter.java55
-rw-r--r--src/core/lombok/SneakyThrows.java73
-rw-r--r--src/core/lombok/Synchronized.java46
-rw-r--r--src/core/lombok/ToString.java81
-rw-r--r--src/core/lombok/core/AST.java367
-rw-r--r--src/core/lombok/core/AnnotationValues.java419
-rw-r--r--src/core/lombok/core/LombokNode.java297
-rw-r--r--src/core/lombok/core/PrintAST.java51
-rw-r--r--src/core/lombok/core/SpiLoadUtil.java164
-rw-r--r--src/core/lombok/core/TransformationsUtil.java149
-rw-r--r--src/core/lombok/core/TypeLibrary.java79
-rw-r--r--src/core/lombok/core/TypeResolver.java114
-rw-r--r--src/core/lombok/core/Version.java48
-rw-r--r--src/core/lombok/core/package-info.java30
-rw-r--r--src/core/lombok/eclipse/Eclipse.java479
-rw-r--r--src/core/lombok/eclipse/EclipseAST.java366
-rw-r--r--src/core/lombok/eclipse/EclipseASTAdapter.java101
-rw-r--r--src/core/lombok/eclipse/EclipseASTVisitor.java295
-rw-r--r--src/core/lombok/eclipse/EclipseAnnotationHandler.java54
-rw-r--r--src/core/lombok/eclipse/EclipseNode.java175
-rw-r--r--src/core/lombok/eclipse/HandlerLibrary.java200
-rw-r--r--src/core/lombok/eclipse/TransformEclipseAST.java196
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java385
-rw-r--r--src/core/lombok/eclipse/handlers/HandleCleanup.java200
-rw-r--r--src/core/lombok/eclipse/handlers/HandleData.java243
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java718
-rw-r--r--src/core/lombok/eclipse/handlers/HandleGetter.java154
-rw-r--r--src/core/lombok/eclipse/handlers/HandlePrintAST.java57
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSetter.java172
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSneakyThrows.java224
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSynchronized.java132
-rw-r--r--src/core/lombok/eclipse/handlers/HandleToString.java304
-rw-r--r--src/core/lombok/eclipse/handlers/package-info.java26
-rw-r--r--src/core/lombok/eclipse/package-info.java26
-rw-r--r--src/core/lombok/javac/HandlerLibrary.java219
-rw-r--r--src/core/lombok/javac/Javac.java162
-rw-r--r--src/core/lombok/javac/JavacAST.java347
-rw-r--r--src/core/lombok/javac/JavacASTAdapter.java98
-rw-r--r--src/core/lombok/javac/JavacASTVisitor.java266
-rw-r--r--src/core/lombok/javac/JavacAnnotationHandler.java58
-rw-r--r--src/core/lombok/javac/JavacNode.java212
-rw-r--r--src/core/lombok/javac/apt/Processor.java175
-rw-r--r--src/core/lombok/javac/apt/package-info.java26
-rw-r--r--src/core/lombok/javac/handlers/HandleCleanup.java147
-rw-r--r--src/core/lombok/javac/handlers/HandleData.java186
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java447
-rw-r--r--src/core/lombok/javac/handlers/HandleGetter.java143
-rw-r--r--src/core/lombok/javac/handlers/HandlePrintAST.java57
-rw-r--r--src/core/lombok/javac/handlers/HandleSetter.java153
-rw-r--r--src/core/lombok/javac/handlers/HandleSneakyThrows.java110
-rw-r--r--src/core/lombok/javac/handlers/HandleSynchronized.java102
-rw-r--r--src/core/lombok/javac/handlers/HandleToString.java237
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java335
-rw-r--r--src/core/lombok/javac/handlers/package-info.java26
-rw-r--r--src/core/lombok/javac/package-info.java26
-rw-r--r--src/core/lombok/package-info.java27
63 files changed, 10453 insertions, 0 deletions
diff --git a/src/core/lombok/AccessLevel.java b/src/core/lombok/AccessLevel.java
new file mode 100644
index 00000000..16edd108
--- /dev/null
+++ b/src/core/lombok/AccessLevel.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+/**
+ * Represents an AccessLevel. Used e.g. to specify the access level for generated methods and fields.
+ */
+public enum AccessLevel {
+ PUBLIC, MODULE, PROTECTED, PACKAGE, PRIVATE,
+ /** Represents not generating anything or the complete lack of a method. */
+ NONE;
+}
diff --git a/src/core/lombok/Cleanup.java b/src/core/lombok/Cleanup.java
new file mode 100644
index 00000000..ce9e0aa9
--- /dev/null
+++ b/src/core/lombok/Cleanup.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Ensures the variable declaration that you annotate will be cleaned up by calling its close method, regardless
+ * of what happens. Implemented by wrapping all statements following the local variable declaration to the
+ * end of your scope into a try block that, as a finally action, closes the resource.
+ * <p>
+ * Example:
+ * <pre>
+ * public void copyFile(String in, String out) throws IOException {
+ * &#64;Cleanup FileInputStream inStream = new FileInputStream(in);
+ * &#64;Cleanup FileOutputStream outStream = new FileOutputStream(out);
+ * byte[] b = new byte[65536];
+ * while (true) {
+ * int r = inStream.read(b);
+ * if (r == -1) break;
+ * outStream.write(b, 0, r);
+ * }
+ * }
+ * </pre>
+ *
+ * Will generate:
+ * <pre>
+ * public void copyFile(String in, String out) throws IOException {
+ * &#64;Cleanup FileInputStream inStream = new FileInputStream(in);
+ * try {
+ * &#64;Cleanup FileOutputStream outStream = new FileOutputStream(out);
+ * try {
+ * byte[] b = new byte[65536];
+ * while (true) {
+ * int r = inStream.read(b);
+ * if (r == -1) break;
+ * outStream.write(b, 0, r);
+ * }
+ * } finally {
+ * out.close();
+ * }
+ * } finally {
+ * in.close();
+ * }
+ * }
+ * </pre>
+ *
+ * Note that the final close method call, if it throws an exception, will overwrite any exception thrown
+ * in the main body of the generated try block. You should NOT rely on this behaviour - future versions of
+ * lombok intend to silently swallow any exception thrown by the cleanup method <i>_IF</i> the main body
+ * throws an exception as well, as the earlier exception is usually far more useful.
+ * <p>
+ * However, in java 1.6, generating the code to do this is prohibitively complicated.
+ */
+@Target(ElementType.LOCAL_VARIABLE)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Cleanup {
+ /** The name of the method that cleans up the resource. By default, 'close'. The method must not have any parameters. */
+ String value() default "close";
+}
diff --git a/src/core/lombok/Data.java b/src/core/lombok/Data.java
new file mode 100644
index 00000000..488de640
--- /dev/null
+++ b/src/core/lombok/Data.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Generates getters for all fields, a useful toString method, and hashCode and equals implementations that check
+ * all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor.
+ * <p>
+ * If any method to be generated already exists (in name - the return type or parameters are not relevant), then
+ * that method will not be generated by the Data annotation.
+ * <p>
+ * The generated constructor will have 1 parameter for each final field. The generated toString will print all fields,
+ * 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 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)
+public @interface Data {
+ /**
+ * If you specify a static constructor name, then the generated constructor will be private, and
+ * instead a static factory method is created that other classes can use to create instances.
+ * We suggest the name: "of", like so:
+ *
+ * <pre>
+ * public @Data(staticConstructor = "of") class Point { final int x, y; }
+ * </pre>
+ *
+ * Default: No static constructor, instead the normal constructor is public.
+ */
+ String staticConstructor() default "";
+}
diff --git a/src/core/lombok/EqualsAndHashCode.java b/src/core/lombok/EqualsAndHashCode.java
new file mode 100644
index 00000000..88d72051
--- /dev/null
+++ b/src/core/lombok/EqualsAndHashCode.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Generates implementations for the {@code equals} and {@code hashCode} methods inherited by all objects.
+ * <p>
+ * 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} 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} 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} 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} 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} 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}. 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.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.SOURCE)
+public @interface EqualsAndHashCode {
+ /**
+ * Any fields listed here will not be taken into account in the generated
+ * {@code equals} and {@code hashCode} implementations.
+ * Mutually exclusive with {@link #of()}.
+ */
+ String[] exclude() default {};
+
+ /**
+ * If present, explicitly lists the fields that are to be used for identity.
+ * Normally, all non-static, non-transient fields are used for identity.
+ * <p>
+ * Mutually exclusive with {@link #exclude()}.
+ */
+ String[] of() default {};
+
+ /**
+ * Call on the superclass's implementations of {@code equals} and {@code hashCode} before calculating
+ * for the fields in this class.
+ * <strong>default: false</strong>
+ */
+ boolean callSuper() default false;
+}
diff --git a/src/core/lombok/Getter.java b/src/core/lombok/Getter.java
new file mode 100644
index 00000000..fa84954c
--- /dev/null
+++ b/src/core/lombok/Getter.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Put on any field to make lombok build a standard getter.
+ *
+ * Example:
+ * <pre>
+ * private &#64;Getter int foo;
+ * </pre>
+ *
+ * will generate:
+ *
+ * <pre>
+ * public int getFoo() {
+ * return this.foo;
+ * }
+ * </pre>
+ *
+ * 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 isFoo} exists, regardless of return type or parameters, no method is generated,
+ * and instead a compiler warning is emitted.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Getter {
+ /**
+ * If you want your setter to be non-public, you can specify an alternate access level here.
+ */
+ lombok.AccessLevel value() default lombok.AccessLevel.PUBLIC;
+}
diff --git a/src/core/lombok/Lombok.java b/src/core/lombok/Lombok.java
new file mode 100644
index 00000000..71684f4f
--- /dev/null
+++ b/src/core/lombok/Lombok.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+/**
+ * Useful utility methods to manipulate lombok-generated code.
+ */
+public class Lombok {
+ /**
+ * Throws any throwable 'sneakily' - you don't need to catch it, nor declare that you throw it onwards.
+ * The exception is still thrown - javac will just stop whining about it.
+ * <p>
+ * Example usage:
+ * <p>
+ * <pre>public void run() {
+ * throw sneakyThrow(new IOException("You don't need to catch me!"));
+ * }</pre>
+ * <p>
+ * NB: The exception is not wrapped, ignored, swallowed, or redefined. The JVM actually does not know or care
+ * 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} 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.
+ * @return A dummy RuntimeException; this method never returns normally, it <em>always</em> throws an exception!
+ */
+ public static RuntimeException sneakyThrow(Throwable t) {
+ if (t == null) throw new NullPointerException("t");
+ Lombok.<RuntimeException>sneakyThrow0(t);
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T extends Throwable> void sneakyThrow0(Throwable t) throws T {
+ throw (T)t;
+ }
+}
diff --git a/src/core/lombok/NonNull.java b/src/core/lombok/NonNull.java
new file mode 100644
index 00000000..08eec2a5
--- /dev/null
+++ b/src/core/lombok/NonNull.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2009 Reinier Zwitserloot and Roel Spilker.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Lombok is smart enough to translate any annotation named {@code @NonNull} or {@code @NotNull} in any casing and
+ * with any package name to the retur