diff options
| author | Reinier Zwitserloot <reinier@tipit.to> | 2009-11-25 07:32:49 +0100 |
|---|---|---|
| committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-11-25 07:32:49 +0100 |
| commit | 1a0e611a9c5e1ee518670647ce1a44beae559b44 (patch) | |
| tree | e5ef8f671bc6688f486e874d4e2e1a7813e4f0b2 /src/lombok | |
| parent | 7fd947ea40c25dad9ee543ebc4b92de9a2e05efc (diff) | |
| download | lombok-1a0e611a9c5e1ee518670647ce1a44beae559b44.tar.gz lombok-1a0e611a9c5e1ee518670647ce1a44beae559b44.tar.bz2 lombok-1a0e611a9c5e1ee518670647ce1a44beae559b44.zip | |
Refactored the source folders.
Diffstat (limited to 'src/lombok')
77 files changed, 0 insertions, 12593 deletions
diff --git a/src/lombok/AccessLevel.java b/src/lombok/AccessLevel.java deleted file mode 100644 index 16edd108..00000000 --- a/src/lombok/AccessLevel.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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/lombok/Cleanup.java b/src/lombok/Cleanup.java deleted file mode 100644 index ce9e0aa9..00000000 --- a/src/lombok/Cleanup.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 { - * @Cleanup FileInputStream inStream = new FileInputStream(in); - * @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 { - * @Cleanup FileInputStream inStream = new FileInputStream(in); - * try { - * @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/lombok/Data.java b/src/lombok/Data.java deleted file mode 100644 index 488de640..00000000 --- a/src/lombok/Data.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/lombok/EqualsAndHashCode.java b/src/lombok/EqualsAndHashCode.java deleted file mode 100644 index 88d72051..00000000 --- a/src/lombok/EqualsAndHashCode.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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/lombok/Getter.java b/src/lombok/Getter.java deleted file mode 100644 index fa84954c..00000000 --- a/src/lombok/Getter.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 @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/lombok/Lombok.java b/src/lombok/Lombok.java deleted file mode 100644 index 71684f4f..00000000 --- a/src/lombok/Lombok.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 |
