From 0b2cca0eb9de873998535af15c0066a71e2e363f Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Thu, 1 Feb 2018 17:06:32 +0100 Subject: [website] added the German JUG week to the main page. --- website/templates/main.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'website') diff --git a/website/templates/main.html b/website/templates/main.html index d52df167..00d64dab 100644 --- a/website/templates/main.html +++ b/website/templates/main.html @@ -31,5 +31,18 @@
+
+ <@main.h2 title="Upcoming presentations" /> +

+ Roel and Reinier will be talking about (near) future java features; a preview of what Java10 and Java11 will probably look like, across germany:

+ See you there! (We'll have stickers!) +

+
-- cgit From bb95ad218d29a9f5b1011b7c7b919ed41337a00b Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 6 Feb 2018 06:17:28 +0100 Subject: [website] Updated docs for JDK9 module-info support. --- website/templates/setup/javac.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'website') diff --git a/website/templates/setup/javac.html b/website/templates/setup/javac.html index 9cc9a560..113be9c0 100644 --- a/website/templates/setup/javac.html +++ b/website/templates/setup/javac.html @@ -9,7 +9,18 @@ <@s.section title="JDK 9">

- Support for JDK9 is ongoing. You need to set up some configuration to make lombok play nice with jigsaw (the JDK9 module system). The github issue about JDK9 support for Lombok has the details on how to set it up. + Support for JDK9, if you haven't modularized your own projects yet (no module-info.java yet), is included in lombok starting with version 1.16.20. Just use lombok as normal: javac -cp lombok.jar ... +

+ Support for JDK9 if you did modularize your own projects (you've written a module-info.java file) is available in the edge release. To use it, you can choose:

+ Both are equally effective. Note that you will have to add lombok to your module-info.java file:
+module myapp {
+	requires lombok;
+}
+

+ Feedback about JDK9 module-info support can be given at github issue #985.

-- cgit From 55bcc142d08ac8a4de0c3965333e3816c496799f Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 6 Feb 2018 22:14:03 +0100 Subject: [jdk9] forcing new rounds when compiling multiple modules didn’t work. (FilerException on creating the new round). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javac/apt/InterceptingJavaFileManager.java | 8 +++--- src/core/lombok/javac/apt/LombokProcessor.java | 30 +++++++++++++++++----- website/templates/setup/javac.html | 4 ++- 3 files changed, 31 insertions(+), 11 deletions(-) (limited to 'website') diff --git a/src/core/lombok/javac/apt/InterceptingJavaFileManager.java b/src/core/lombok/javac/apt/InterceptingJavaFileManager.java index 303bdc2f..a9a4d200 100644 --- a/src/core/lombok/javac/apt/InterceptingJavaFileManager.java +++ b/src/core/lombok/javac/apt/InterceptingJavaFileManager.java @@ -42,14 +42,14 @@ final class InterceptingJavaFileManager extends ForwardingJavaFileManager Both are equally effective. Note that you will have to add lombok to your module-info.java file:
 module myapp {
-	requires lombok;
+	requires static lombok;
 }
+

+ The 'static' part ensures that you won't need lombok to be present at runtime.

Feedback about JDK9 module-info support can be given at github issue #985.

-- cgit From 66469e04fe35e5ceb3723cb563379a03e4883101 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 6 Feb 2018 22:12:42 +0100 Subject: [var] various upgrades to var: * var is promoted to the main package. * It is no longer an opt-in thing. * bug: var (unlike val) is allowed in old-style for loops, but if you multi-init: for (var i = 0, j="Foo";;), you now get an error that you can't do that. * tests both for the multi-for situation and the new main package variant. --- doc/changelog.markdown | 1 + src/core/lombok/core/LombokInternalAliasing.java | 1 + .../lombok/core/configuration/AllowHelper.java | 6 ++-- src/core/lombok/eclipse/handlers/HandleVal.java | 14 ++++++-- src/core/lombok/experimental/var.java | 5 ++- src/core/lombok/javac/handlers/HandleVal.java | 12 +++++-- src/core/lombok/var.java | 35 ++++++++++++++++++++ .../lombok/eclipse/agent/PatchVal.java | 2 +- .../lombok/eclipse/agent/PatchValEclipse.java | 2 +- .../resource/after-delombok/VarWarning.java | 6 ++++ test/transform/resource/after-ecj/VarComplex.java | 2 +- test/transform/resource/after-ecj/VarInFor.java | 2 +- test/transform/resource/after-ecj/VarInForOld.java | 2 +- test/transform/resource/after-ecj/VarNullInit.java | 2 +- test/transform/resource/after-ecj/VarWarning.java | 10 ++++++ test/transform/resource/before/VarComplex.java | 3 +- test/transform/resource/before/VarInFor.java | 3 +- test/transform/resource/before/VarInForOld.java | 3 +- .../resource/before/VarInForOldMulti.java | 10 ++++++ test/transform/resource/before/VarModifier.java | 1 - test/transform/resource/before/VarNullInit.java | 3 +- test/transform/resource/before/VarWarning.java | 3 +- .../VarInForOldMulti.java.messages | 1 + .../messages-delombok/VarNullInit.java.messages | 2 +- .../messages-delombok/VarWarning.java.messages | 2 +- .../ValInTryWithResources.java.messages | 1 + .../messages-ecj/VarInForOldMulti.java.messages | 1 + .../messages-ecj/VarModifier.java.messages | 3 ++ .../messages-ecj/VarNullInit.java.messages | 2 +- .../resource/messages-ecj/VarWarning.java.messages | 2 +- website/templates/features/experimental/var.html | 37 ---------------------- website/templates/features/index.html | 4 +++ website/templates/features/var.html | 27 ++++++++++++++++ 33 files changed, 141 insertions(+), 69 deletions(-) create mode 100644 src/core/lombok/var.java create mode 100644 test/transform/resource/after-delombok/VarWarning.java create mode 100644 test/transform/resource/after-ecj/VarWarning.java create mode 100644 test/transform/resource/before/VarInForOldMulti.java create mode 100644 test/transform/resource/messages-delombok/VarInForOldMulti.java.messages create mode 100644 test/transform/resource/messages-ecj/ValInTryWithResources.java.messages create mode 100644 test/transform/resource/messages-ecj/VarInForOldMulti.java.messages create mode 100644 test/transform/resource/messages-ecj/VarModifier.java.messages delete mode 100644 website/templates/features/experimental/var.html create mode 100644 website/templates/features/var.html (limited to 'website') diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 11c4bddc..fcde09da 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -5,6 +5,7 @@ Lombok Changelog * v1.16.20 is the latest stable release of Project Lombok. * PLATFORM: Fix for using lombok together with JDK9's new `module-info.java` feature. [Issue #985](https://github.com/rzwitserloot/lombok/issues/985) * BUGFIX: Potential fix for Netbeans < 9. [Issue #1555](https://github.com/rzwitserloot/lombok/issues/1555) +* PROMOTION: `var` has been promoted from experimental to the main package with no changes. The 'old' experimental one is still around but is deprecated, and is an alias for the new main package one. [var documentation](https://projectlombok.org/features/var.html). ### v1.16.20 (January 9th, 2018) * PLATFORM: Better support for jdk9 in the new IntelliJ, Netbeans and for Gradle. diff --git a/src/core/lombok/core/LombokInternalAliasing.java b/src/core/lombok/core/LombokInternalAliasing.java index 08764a5c..a1909df3 100644 --- a/src/core/lombok/core/LombokInternalAliasing.java +++ b/src/core/lombok/core/LombokInternalAliasing.java @@ -51,6 +51,7 @@ public class LombokInternalAliasing { Map m2 = new HashMap(); m2.put("lombok.experimental.Value", "lombok.Value"); m2.put("lombok.experimental.Builder", "lombok.Builder"); + m2.put("lombok.experimental.var", "lombok.var"); m2.put("lombok.Delegate", "lombok.experimental.Delegate"); ALIASES = Collections.unmodifiableMap(m2); } diff --git a/src/core/lombok/core/configuration/AllowHelper.java b/src/core/lombok/core/configuration/AllowHelper.java index 3873b055..1146ccde 100644 --- a/src/core/lombok/core/configuration/AllowHelper.java +++ b/src/core/lombok/core/configuration/AllowHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Project Lombok Authors. + * Copyright (C) 2018 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,10 +24,8 @@ package lombok.core.configuration; import java.util.Collection; import java.util.Collections; -import lombok.ConfigurationKeys; - public final class AllowHelper { - private final static Collection> ALLOWABLE = Collections.singleton(ConfigurationKeys.VAR_FLAG_USAGE); + private final static Collection> ALLOWABLE = Collections.emptySet(); private AllowHelper() { // Prevent instantiation diff --git a/src/core/lombok/eclipse/handlers/HandleVal.java b/src/core/lombok/eclipse/handlers/HandleVal.java index d8901067..3742ac00 100644 --- a/src/core/lombok/eclipse/handlers/HandleVal.java +++ b/src/core/lombok/eclipse/handlers/HandleVal.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2016 The Project Lombok Authors. + * Copyright (C) 2010-2018 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,13 +25,14 @@ import static lombok.core.handlers.HandlerUtil.handleFlagUsage; import static lombok.eclipse.handlers.EclipseHandlerUtil.typeMatches; import lombok.ConfigurationKeys; import lombok.val; +import lombok.var; import lombok.core.HandlerPriority; import lombok.eclipse.DeferUntilPostDiet; import lombok.eclipse.EclipseASTAdapter; import lombok.eclipse.EclipseASTVisitor; import lombok.eclipse.EclipseNode; -import lombok.experimental.var; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer; import org.eclipse.jdt.internal.compiler.ast.ForStatement; import org.eclipse.jdt.internal.compiler.ast.ForeachStatement; @@ -74,11 +75,18 @@ public class HandleVal extends EclipseASTAdapter { return; } - if (isVal && localNode.directUp().get() instanceof ForStatement) { + ASTNode parentRaw = localNode.directUp().get(); + + if (isVal && parentRaw instanceof ForStatement) { localNode.addError("'val' is not allowed in old-style for loops"); return; } + if (parentRaw instanceof ForStatement && ((ForStatement) parentRaw).initializations != null && ((ForStatement) parentRaw).initializations.length > 1) { + localNode.addError("'var' is not allowed in old-style for loops if there is more than 1 initializer"); + return; + } + if (local.initialization != null && local.initialization.getClass().getName().equals("org.eclipse.jdt.internal.compiler.ast.LambdaExpression")) { localNode.addError("'" + annotation + "' is not allowed with lambda expressions."); return; diff --git a/src/core/lombok/experimental/var.java b/src/core/lombok/experimental/var.java index d8de8b19..71cc141a 100644 --- a/src/core/lombok/experimental/var.java +++ b/src/core/lombok/experimental/var.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 The Project Lombok Authors. + * Copyright (C) 2010-2017 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -23,6 +23,9 @@ package lombok.experimental; /** * like val but not final + * + * @deprecated {@code var} has been promoted to the main package; use {@link lombok.var} instead. */ +@Deprecated public @interface var { } diff --git a/src/core/lombok/javac/handlers/HandleVal.java b/src/core/lombok/javac/handlers/HandleVal.java index f0f6eb2a..14130bc4 100644 --- a/src/core/lombok/javac/handlers/HandleVal.java +++ b/src/core/lombok/javac/handlers/HandleVal.java @@ -26,7 +26,7 @@ import static lombok.javac.handlers.JavacHandlerUtil.*; import lombok.ConfigurationKeys; import lombok.val; import lombok.core.HandlerPriority; -import lombok.experimental.var; +import lombok.var; import lombok.javac.JavacASTAdapter; import lombok.javac.JavacASTVisitor; import lombok.javac.JavacNode; @@ -54,10 +54,10 @@ import com.sun.tools.javac.util.List; public class HandleVal extends JavacASTAdapter { private static boolean eq(String typeTreeToString, String key) { - return (typeTreeToString.equals(key) || typeTreeToString.equals("lombok." + key)); + return typeTreeToString.equals(key) || typeTreeToString.equals("lombok." + key) || typeTreeToString.equals("lombok.experimental." + key); } - @Override + @SuppressWarnings("deprecation") @Override public void visitLocal(JavacNode localNode, JCVariableDecl local) { JCTree typeTree = local.vartype; if (typeTree == null) return; @@ -77,6 +77,11 @@ public class HandleVal extends JavacASTAdapter { return; } + if (parentRaw instanceof JCForLoop && ((JCForLoop) parentRaw).getInitializer().size() > 1) { + localNode.addError("'var' is not allowed in old-style for loops if there is more than 1 initializer"); + return; + } + JCExpression rhsOfEnhancedForLoop = null; if (local.init == null) { if (parentRaw instanceof JCEnhancedForLoop) { @@ -98,6 +103,7 @@ public class HandleVal extends JavacASTAdapter { if (localNode.shouldDeleteLombokAnnotations()) { JavacHandlerUtil.deleteImportFromCompilationUnit(localNode, val.class.getName()); + JavacHandlerUtil.deleteImportFromCompilationUnit(localNode, lombok.experimental.var.class.getName()); JavacHandlerUtil.deleteImportFromCompilationUnit(localNode, var.class.getName()); } diff --git a/src/core/lombok/var.java b/src/core/lombok/var.java new file mode 100644 index 00000000..63a70213 --- /dev/null +++ b/src/core/lombok/var.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010-2018 The Project Lombok Authors. + * + * 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; + +/** + * Use {@code var} as the type of any local variable declaration (even in a {@code for} statement), and the type will be inferred from the initializing expression + * (any further assignments to the variable are not involved in this type inference). + *

+ * For example: {@code var x = 10.0;} will infer {@code double}, and {@code var y = new ArrayList();} will infer {@code ArrayList}. + *

+ * Note that this is an annotation type because {@code var x = 10;} will be desugared to {@code @var int x = 10;} + *

+ * Complete documentation is found at the project lombok features page for @var. + */ +public @interface var { +} diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java index e4dd7b26..632dd865 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java @@ -212,7 +212,7 @@ public class PatchVal { } private static boolean isVar(LocalDeclaration local, BlockScope scope) { - return is(local.type, scope, "lombok.experimental.var"); + return is(local.type, scope, "lombok.experimental.var") || is(local.type, scope, "lombok.var"); } private static boolean isVal(LocalDeclaration local, BlockScope scope) { diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java index 505eb767..839fce6e 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java @@ -103,7 +103,7 @@ public class PatchValEclipse { } private static boolean couldBeVar(TypeReference type) { - return PatchVal.couldBe("lombok.experimental.var", type); + return PatchVal.couldBe("lombok.experimental.var", type) || PatchVal.couldBe("lombok.var", type); } public static void addFinalAndValAnnotationToSingleVariableDeclaration(Object converter, SingleVariableDeclaration out, LocalDeclaration in) { diff --git a/test/transform/resource/after-delombok/VarWarning.java b/test/transform/resource/after-delombok/VarWarning.java new file mode 100644 index 00000000..a333c87c --- /dev/null +++ b/test/transform/resource/after-delombok/VarWarning.java @@ -0,0 +1,6 @@ +public class VarWarning { + public void isOkay() { + java.lang.String x = "Warning"; + x.toLowerCase(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/VarComplex.java b/test/transform/resource/after-ecj/VarComplex.java index 10c456eb..97a0a177 100644 --- a/test/transform/resource/after-ecj/VarComplex.java +++ b/test/transform/resource/after-ecj/VarComplex.java @@ -1,4 +1,4 @@ -import lombok.experimental.var; +import lombok.var; public class VarComplex { private String field = ""; private static final int CONSTANT = 20; diff --git a/test/transform/resource/after-ecj/VarInFor.java b/test/transform/resource/after-ecj/VarInFor.java index 0192aaed..1799d9b7 100644 --- a/test/transform/resource/after-ecj/VarInFor.java +++ b/test/transform/resource/after-ecj/VarInFor.java @@ -1,4 +1,4 @@ -import lombok.experimental.var; +import lombok.var; public class VarInFor { public VarInFor() { super(); diff --git a/test/transform/resource/after-ecj/VarInForOld.java b/test/transform/resource/after-ecj/VarInForOld.java index 98fedf03..065ea94d 100644 --- a/test/transform/resource/after-ecj/VarInForOld.java +++ b/test/transform/resource/after-ecj/VarInForOld.java @@ -1,4 +1,4 @@ -import lombok.experimental.var; +import lombok.var; public class VarInForOld { public VarInForOld() { super(); diff --git a/test/transform/resource/after-ecj/VarNullInit.java b/test/transform/resource/after-ecj/VarNullInit.java index 3eb2d506..848744cc 100644 --- a/test/transform/resource/after-ecj/VarNullInit.java +++ b/test/transform/resource/after-ecj/VarNullInit.java @@ -1,4 +1,4 @@ -import lombok.experimental.var; +import lombok.var; public class VarNullInit { public VarNullInit() { super(); diff --git a/test/transform/resource/after-ecj/VarWarning.java b/test/transform/resource/after-ecj/VarWarning.java new file mode 100644 index 00000000..4caf90f8 --- /dev/null +++ b/test/transform/resource/after-ecj/VarWarning.java @@ -0,0 +1,10 @@ +import lombok.var; +public class VarWarning { + public VarWarning() { + super(); + } + public void isOkay() { + @var java.lang.String x = "Warning"; + x.toLowerCase(); + } +} \ No newline at end of file diff --git a/test/transform/resource/before/VarComplex.java b/test/transform/resource/before/VarComplex.java index bfaa8804..c93e177a 100644 --- a/test/transform/resource/before/VarComplex.java +++ b/test/transform/resource/before/VarComplex.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarComplex { private String field = ""; diff --git a/test/transform/resource/before/VarInFor.java b/test/transform/resource/before/VarInFor.java index cc8c387e..7f7bb7a7 100644 --- a/test/transform/resource/before/VarInFor.java +++ b/test/transform/resource/before/VarInFor.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarInFor { public void enhancedFor() { diff --git a/test/transform/resource/before/VarInForOld.java b/test/transform/resource/before/VarInForOld.java index f90aba7f..99e83b57 100644 --- a/test/transform/resource/before/VarInForOld.java +++ b/test/transform/resource/before/VarInForOld.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarInForOld { public void oldFor() { diff --git a/test/transform/resource/before/VarInForOldMulti.java b/test/transform/resource/before/VarInForOldMulti.java new file mode 100644 index 00000000..e2ea9682 --- /dev/null +++ b/test/transform/resource/before/VarInForOldMulti.java @@ -0,0 +1,10 @@ +//skip compare contents +import lombok.var; + +public class VarInForOldMulti { + public void oldForMulti() { + for (var i = 0, j = "Hey"; i < 100; ++i) { + System.out.println(i); + } + } +} \ No newline at end of file diff --git a/test/transform/resource/before/VarModifier.java b/test/transform/resource/before/VarModifier.java index 7250c1c5..5c68caa7 100644 --- a/test/transform/resource/before/VarModifier.java +++ b/test/transform/resource/before/VarModifier.java @@ -1,4 +1,3 @@ -//CONF: lombok.var.flagUsage = ALLOW import lombok.experimental.var; public class VarModifier { diff --git a/test/transform/resource/before/VarNullInit.java b/test/transform/resource/before/VarNullInit.java index efdc9d9e..f9bb53a3 100644 --- a/test/transform/resource/before/VarNullInit.java +++ b/test/transform/resource/before/VarNullInit.java @@ -1,5 +1,4 @@ -//CONF: lombok.var.flagUsage = ALLOW -import lombok.experimental.var; +import lombok.var; public class VarNullInit { void method() { diff --git a/test/transform/resource/before/VarWarning.java b/test/transform/resource/before/VarWarning.java index 85559587..90464d30 100644 --- a/test/transform/resource/before/VarWarning.java +++ b/test/transform/resource/before/VarWarning.java @@ -1,6 +1,5 @@ //CONF: lombok.var.flagUsage = WARNING -//skip compare contents -import lombok.experimental.var; +import lombok.var; public class VarWarning { public void isOkay() { diff --git a/test/transform/resource/messages-delombok/VarInForOldMulti.java.messages b/test/transform/resource/messages-delombok/VarInForOldMulti.java.messages new file mode 100644 index 00000000..f65fe823 --- /dev/null +++ b/test/transform/resource/messages-delombok/VarInForOldMulti.java.messages @@ -0,0 +1 @@ +6 'var' is not allowed in old-style for loops if there is more than 1 initializer diff --git a/test/transform/resource/messages-delombok/VarNullInit.java.messages b/test/transform/resource/messages-delombok/VarNullInit.java.messages index 190ab7c4..5a2a6ae1 100644 --- a/test/transform/resource/messages-delombok/VarNullInit.java.messages +++ b/test/transform/resource/messages-delombok/VarNullInit.java.messages @@ -1 +1 @@ -6 variable initializer is 'null' \ No newline at end of file +5 variable initializer is 'null' \ No newline at end of file diff --git a/test/transform/resource/messages-delombok/VarWarning.java.messages b/test/transform/resource/messages-delombok/VarWarning.java.messages index 48c89581..886e98f4 100644 --- a/test/transform/resource/messages-delombok/VarWarning.java.messages +++ b/test/transform/resource/messages-delombok/VarWarning.java.messages @@ -1 +1 @@ -7 Use of var is flagged according to lombok configuration \ No newline at end of file +6 Use of var is flagged according to lombok configuration \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/ValInTryWithResources.java.messages b/test/transform/resource/messages-ecj/ValInTryWithResources.java.messages new file mode 100644 index 00000000..9d0d7a6e --- /dev/null +++ b/test/transform/resource/messages-ecj/ValInTryWithResources.java.messages @@ -0,0 +1 @@ +OPTIONAL 8 Resource leak: 'i' is never closed diff --git a/test/transform/resource/messages-ecj/VarInForOldMulti.java.messages b/test/transform/resource/messages-ecj/VarInForOldMulti.java.messages new file mode 100644 index 00000000..0bfd6e65 --- /dev/null +++ b/test/transform/resource/messages-ecj/VarInForOldMulti.java.messages @@ -0,0 +1 @@ +6 'var' is not allowed in old-style for loops if there is more than 1 initializer \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/VarModifier.java.messages b/test/transform/resource/messages-ecj/VarModifier.java.messages new file mode 100644 index 00000000..051d1ad7 --- /dev/null +++ b/test/transform/resource/messages-ecj/VarModifier.java.messages @@ -0,0 +1,3 @@ +1 The type var is deprecated +7 The type var is deprecated +8 The type var is deprecated diff --git a/test/transform/resource/messages-ecj/VarNullInit.java.messages b/test/transform/resource/messages-ecj/VarNullInit.java.messages index 190ab7c4..5a2a6ae1 100644 --- a/test/transform/resource/messages-ecj/VarNullInit.java.messages +++ b/test/transform/resource/messages-ecj/VarNullInit.java.messages @@ -1 +1 @@ -6 variable initializer is 'null' \ No newline at end of file +5 variable initializer is 'null' \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/VarWarning.java.messages b/test/transform/resource/messages-ecj/VarWarning.java.messages index 48c89581..25096b84 100644 --- a/test/transform/resource/messages-ecj/VarWarning.java.messages +++ b/test/transform/resource/messages-ecj/VarWarning.java.messages @@ -1 +1 @@ -7 Use of var is flagged according to lombok configuration \ No newline at end of file +6 Use of var is flagged according to lombok configuration. \ No newline at end of file diff --git a/website/templates/features/experimental/var.html b/website/templates/features/experimental/var.html deleted file mode 100644 index fa35ac5e..00000000 --- a/website/templates/features/experimental/var.html +++ /dev/null @@ -1,37 +0,0 @@ -<#import "../_features.html" as f> - -<@f.scaffold title="var" logline="Modifiable local variables with a type inferred by assigning value."> - <@f.history> -

- var was introduced in lombok 1.16.12 as experimental feature. -

- - - <@f.experimental> -
    -
  • - This feature is very controversial. -
  • - There is JEP 286 that should make var obsolete. -
  • -
- Current status: uncertain – Currently we feel this feature cannot move out of experimental status. - - - <@f.overview> -

- var works exactly like val, except the local variable is not marked as final. -

- The type is still entirely derived from the mandatory initializer expression, and any further assignments, while now legal (because the variable is no longer final), aren't looked at to determine the appropriate type.
- For example, var x = "Hello"; x = Color.RED; does not work; the type of x will be inferred to be java.lang.String and thus, the x = Color.RED assignment will fail. If the type of x was inferred to be java.lang.Object this code would have compiled, but that's not howvar works. -

- - - <@f.confKeys> -
- lombok.var.flagUsage = [warning | error] (default: not set) -
- Lombok will flag any usage of var as a warning or error if configured. -
- - diff --git a/website/templates/features/index.html b/website/templates/features/index.html index 73b5dce8..d077ab4d 100644 --- a/website/templates/features/index.html +++ b/website/templates/features/index.html @@ -12,6 +12,10 @@ Finally! Hassle-free final local variables. + <@main.feature title="var" href="var"> + Mutably! Hassle-free local variables. + + <@main.feature title="@NonNull" href="NonNull"> or: How I learned to stop worrying and love the NullPointerException. diff --git a/website/templates/features/var.html b/website/templates/features/var.html new file mode 100644 index 00000000..60e24914 --- /dev/null +++ b/website/templates/features/var.html @@ -0,0 +1,27 @@ +<#import "_features.html" as f> + +<@f.scaffold title="var" logline="Mutably! Hassle-free local variables."> + <@f.history> +

    +
  • var was promoted to the main package in lombok 2.0.0; given that JEP 286 establishes expectations, and lombok's take on var follows these, we've decided to promote var eventhough the feature remains controversial.
  • +
  • var was introduced in lombok 1.16.12 as experimental feature.
  • +

+ + + <@f.overview> +

+ var works exactly like val, except the local variable is not marked as final. +

+ The type is still entirely derived from the mandatory initializer expression, and any further assignments, while now legal (because the variable is no longer final), aren't looked at to determine the appropriate type.
+ For example, var x = "Hello"; x = Color.RED; does not work; the type of x will be inferred to be java.lang.String and thus, the x = Color.RED assignment will fail. If the type of x was inferred to be java.lang.Object this code would have compiled, but that's not howvar works. +

+ + + <@f.confKeys> +
+ lombok.var.flagUsage = [warning | error] (default: not set) +
+ Lombok will flag any usage of var as a warning or error if configured. +
+ + -- cgit From 6484537e2e87ff990b3de574876490f0bdd7e0ec Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 6 Feb 2018 22:42:38 +0100 Subject: URLs to the ‘experimental’ feature page of features that have been promoted will now redirect (permanently) to the (non-experimental) feature page equivalent. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/extra/htaccess | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'website') diff --git a/website/extra/htaccess b/website/extra/htaccess index fd18c145..ea53d49c 100644 --- a/website/extra/htaccess +++ b/website/extra/htaccess @@ -39,6 +39,10 @@ RewriteRule ^features/${pg?no_esc}$ /features/${pg?no_esc}.html [L,END] RewriteRule ^features/${pg?no_esc}(\.html)?$ /features/${pg?no_esc} [NC,R=301] +RewriteRule ^features/experimental/Builder(\.html)?$ /features/Builder [NC,R=301] +RewriteRule ^features/experimental/Value(\.html)?$ /features/Value [NC,R=301] +RewriteRule ^features/experimental/var(\.html)?$ /features/var [NC,R=301] + RewriteRule ^features/experimental/all$ /features/experimental/index.html [L,END] RewriteRule ^features/experimental(/all)?$ /features/experimental/all [NC,R=301] RewriteRule ^features/experimental/index(\.html)?$ /features/experimental/all [NC,R=301] -- cgit From 45967c522eca156bf0eeae14ebd9f466d23bd470 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 7 Feb 2018 00:49:23 +0100 Subject: [trivial] updated comment and slight tweak to website text. --- build.xml | 2 +- website/templates/setup/javac.html | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'website') diff --git a/build.xml b/build.xml index 3a8d6c14..14d67ffc 100644 --- a/build.xml +++ b/build.xml @@ -221,7 +221,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr - + diff --git a/website/templates/setup/javac.html b/website/templates/setup/javac.html index f90cb727..48b0ebcf 100644 --- a/website/templates/setup/javac.html +++ b/website/templates/setup/javac.html @@ -11,11 +11,8 @@

Support for JDK9, if you haven't modularized your own projects yet (no module-info.java yet), is included in lombok starting with version 1.16.20. Just use lombok as normal: javac -cp lombok.jar ...

- Support for JDK9 if you did modularize your own projects (you've written a module-info.java file) is available in the edge release. To use it, you can choose:

    -
  • javac --processor-module-path lombok.jar -p lombok.jar ...
  • -
  • javac -cp lombok.jar -p lombok.jar ...
  • -
- Both are equally effective. Note that you will have to add lombok to your module-info.java file:
+			Support for JDK9 if you did modularize your own projects (you've written a module-info.java file) is available in the edge release. To use it: javac -cp lombok.jar -p lombok.jar ...
+ Note that you will have to add lombok to your module-info.java file:
 module myapp {
 	requires static lombok;
 }
-- cgit From 757ddee80765600a542f2470c9487d0ba793f62c Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Fri, 2 Mar 2018 16:34:28 +0100 Subject: [website] Added JUG details and updated links for german JUG week. --- website/templates/main.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'website') diff --git a/website/templates/main.html b/website/templates/main.html index 00d64dab..2089cb5e 100644 --- a/website/templates/main.html +++ b/website/templates/main.html @@ -35,10 +35,10 @@ <@main.h2 title="Upcoming presentations" />

Roel and Reinier will be talking about (near) future java features; a preview of what Java10 and Java11 will probably look like, across germany:

See you there! (We'll have stickers!) -- cgit From cc55391a7544b0ce0cc37b8aa628dc8f9a46db49 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 2 Oct 2017 15:50:06 +0200 Subject: Website updated to list supporters on the website. --- .gitignore | 3 +- build.xml | 13 +- buildScripts/ivy.xml | 15 ++- buildScripts/supporters.ant.xml | 57 ++++++++ buildScripts/website.ant.xml | 12 +- website/resources/css/custom.css | 23 ++++ website/resources/files/supporters.json | 13 ++ website/resources/img/spinner.gif | Bin 0 -> 828 bytes website/resources/js/order-license.js | 102 ++++++++++++++ website/resources/js/supporters.js | 214 ++++++++++++++++++++++++++++++ website/templates/main.html | 1 + website/templates/order-license-info.html | 24 ++++ website/templates/order-license.html | 78 +++++++++++ website/templates/supporters.html | 10 ++ 14 files changed, 554 insertions(+), 11 deletions(-) create mode 100644 buildScripts/supporters.ant.xml create mode 100644 website/resources/files/supporters.json create mode 100644 website/resources/img/spinner.gif create mode 100644 website/resources/js/order-license.js create mode 100644 website/resources/js/supporters.js create mode 100644 website/templates/order-license-info.html create mode 100644 website/templates/order-license.html create mode 100644 website/templates/supporters.html (limited to 'website') diff --git a/.gitignore b/.gitignore index b05ce2c6..49316515 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ /junit*.properties /eclipse.location /.apt_generated/ -/out \ No newline at end of file +/out +/website/lombokSupporters diff --git a/build.xml b/build.xml index 14d67ffc..629db4a6 100644 --- a/build.xml +++ b/build.xml @@ -118,6 +118,11 @@ the common tasks and can be called on to run the main aspects of all the sub-scr + + + + + @@ -889,7 +894,11 @@ You can also create your own by writing a 'testenvironment.properties' file. The - + + + + @@ -897,7 +906,7 @@ You can also create your own by writing a 'testenvironment.properties' file. The - diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml index 81f50f4c..cf62377e 100644 --- a/buildScripts/ivy.xml +++ b/buildScripts/ivy.xml @@ -14,6 +14,7 @@ + @@ -22,10 +23,10 @@ - - - - + + + + @@ -56,5 +57,11 @@ + + + + + + diff --git a/buildScripts/supporters.ant.xml b/buildScripts/supporters.ant.xml new file mode 100644 index 00000000..d19e0bb6 --- /dev/null +++ b/buildScripts/supporters.ant.xml @@ -0,0 +1,57 @@ + + + +This buildfile is part of projectlombok.org. It is responsible for updating/maintaining the separate git repository +containing the status of lombok's supporters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index 15a0f95f..5c996fc6 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -37,13 +37,17 @@ such as applying the templates to produce the website, converting the changelog - + - + + + + + lombok.version already set. @@ -134,8 +138,8 @@ such as applying the templates to produce the website, converting the changelog - - + + "); + img.css({ + "max-width": "500px", + "max-height": "300px" + }); + $("#logoCnt").append(img).show(); + img.attr("src", dataUrl); + }); + } catch (e) { + if (console && console.log) console.log(e); + } + } + + function processImageUpload(fnc) { + var f = $("#logo")[0].files[0]; + if (!f) return; + if (f.size > 10000000) return "Logo too large; please give us a logo below 10MiB in size."; + var imageType = /^image\//; + if (!imageType.test(f.type)) return "Please upload an image, for example in PNG format."; + var reader = new FileReader(); + reader.onload = function(e) { + imgDataUrl = e.target.result; + if (fnc) fnc(e.target.result); + }; + reader.readAsDataURL(f); + return null; + } + + $(applyLicense); +})(); diff --git a/website/resources/js/supporters.js b/website/resources/js/supporters.js new file mode 100644 index 00000000..5ec1b057 --- /dev/null +++ b/website/resources/js/supporters.js @@ -0,0 +1,214 @@ +"use strict"; + +(function($) { + var supporters = {}; + var weights = {}; + var types = ["patron", "professional", "enterprise"]; + + function shuffle(array) { + var i = 0, j = 0, temp = null; + for (i = array.length - 1; i > 0; i -= 1) { + j = Math.floor(Math.random() * (i + 1)); + temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + } + + function pad(number) { + return number < 10 ? '0' + number : number; + } + + function fromDate(d) { + return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()); + + } + + function toDate(s) { + var x = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s); + if (x) return new Date(parseInt(x[1]), parseInt(x[2]), parseInt(x[3])); + return null; + } + + function Supporter(type, json) { + this.type = type; + this.name = json.name; + this.logo = json.logo; + this.url = json.url; + this.showName = json.showName; + this.start = json.range ? toDate(json.range[0]) : null; + this.end = json.range ? toDate(json.range[1]) : null; + this.weight = (!json.weight && json.weight !== 0.0) ? 1.0 : json.weight; + } + + Supporter.prototype.inRange = function(d) { + return (!this.start || this.start <= d) && (!this.end || this.end > d); + }; + + Supporter.prototype.render = function() { + var d = $("
").addClass("supportItem").addClass(this.type); + var a = d; + if (this.url) { + a = $("").attr("href", this.url).attr("rel", "noopener"); + d.append(a); + } + var n = $("").text(this.name); + a.append(n); + + if (this.logo) { + a.addClass("logo"); + var i = new Image(); + var showName = this.showName; + i.onload = function() { + var w = i.width; + var h = i.height; + var wf = w / 162; + var hf = h / 80; + var f = hf > wf ? hf : wf; + var wt = Math.round(w / f); + var ht = Math.round(h / f); + i.width = wt; + i.height = ht; + if (!showName) a.empty(); + a.prepend(i); + }; + i.src = 'files/' + this.logo; + } + return d; + } + + function errorHandler(xhr, statusText, err) { + var errMsg = "Can't connect to projectlombok.org to fetch the list of licensees and supporters."; + if (console && console.log) { + console.log("AJAX error for loading list of supporters:"); + console.log(err); + } + var errBox = $("
").addClass("errorBox").text(errMsg); + $(".supporters").text("").append(errBox); + } + + function successHandler(data) { + $.each(types, function() { + var t = this; + supporters[t] = []; + if (data && data[t]) $.each(data[t], function() { + supporters[t].push(new Supporter(t, this)); + }); + }); + weights = data.modWeight; + if (typeof weights !== 'object') weights = {}; + updatePage(); + } + + function build() { + var spinner = $("").attr("title", "loading").attr("src", "/img/spinner.gif").addClass("spinner"); + $(".supporters").append(spinner); + $.ajax({ + url: "/files/supporters.json", + dataType: "json", + cache: true, + error: errorHandler, + success: function(data) { + spinner.remove(); + successHandler(data); + } + }); + } + + function applySupporters() { + build(); + } + + function updatePage() { + updateSupporters(); + updateSupporterBar(); + } + + var supPerBar = 4; + function updateSupporterBar() { + var s = $(".supporterBar"); + s.find(".introText").show(); + s.append($("
").addClass("sbCnt")); + s = s.find(".sbCnt"); + var now = new Date(); + var list = []; + $.each(types, function() { + var t = this; + $.each(supporters[t], function() { + if (this.inRange(now)) { + var w = weights[t] ? weights[t] : 1.0; + if (this.weight) w = w * this.weight; + for (var i = 0; i < w; i++) list.push(this); + } + }); + }); + + shuffle(list); + + var len = list.length; + var pos = 0; + var c = [], cd = []; + for (var i = 0; i < supPerBar; i++) { + c[i] = null; + cd[i] = $("
").addClass("barItem"); + } + + var upd = function() { + var nw = [], a = [], fo = $(), fi = $(); + var sPos = pos; + for (var i = 0; i < supPerBar; i++) { + if (++pos === len) pos = 0; + var z = false; + for (var j = 0; j < i; j++) if (nw[j] === list[pos]) z = true; + if (z) i--; + else nw[i] = list[pos]; + if (pos === sPos) break; + } + for (var i = 0; i < supPerBar; i++) a[i] = (nw[i] === c[i] || !nw[i]) ? null : nw[i].render(i + 1).hide(); + for (var i = 0; i < supPerBar; i++) { + if (a[i]) { + fi = fi.add(a[i]); + fo = fo.add(cd[i].children()); + if (cd[i].parent().length === 0) s.append(cd[i]); + cd[i].append(a[i]); + c[i] = nw[i]; + } + } + + if (fo.length === 0) fi.fadeIn(); + else { + fo.fadeOut("normal", function() { + fi.fadeIn(); + fo.remove(); + }); + } + }; + + setInterval(upd, 10000); + upd(); + } + + function updateSupporters() { + var s = $(".supporters"); + s.empty(); + var now = new Date(); + $.each(types, function() { + var t = this; + var d = $("
").addClass("row"); + var h = $("

").text(t); + d.append(h); + $.each(supporters[t], function() { + if (this.inRange(now)) d.append(this.render()); + }); + if (d.children().length > 1) s.append(d); + }); + if (s.children().length < 1) { + var x = $("
").addClass("noSupportersBox").html( + "We don't have any supporters yet this month.
Become a patron " + + "or order a professional or enterprise license today!"); + s.append(x); + } + } + + $(applySupporters); +})($); \ No newline at end of file diff --git a/website/templates/main.html b/website/templates/main.html index 2089cb5e..df096955 100644 --- a/website/templates/main.html +++ b/website/templates/main.html @@ -29,6 +29,7 @@

+
diff --git a/website/templates/order-license-info.html b/website/templates/order-license-info.html new file mode 100644 index 00000000..b465eaf0 --- /dev/null +++ b/website/templates/order-license-info.html @@ -0,0 +1,24 @@ +<#import "/_scaffold.html" as main> + +<@main.scaffold> + + diff --git a/website/templates/order-license.html b/website/templates/order-license.html new file mode 100644 index 00000000..4d52d93a --- /dev/null +++ b/website/templates/order-license.html @@ -0,0 +1,78 @@ +<#import "/_scaffold.html" as main> + +<@main.scaffold load=["/js/order-license.js"]> + +
+Form fields: + +* EU / US / Elders +* Naam bedrijf +* Do you want to be mentioned? +* Link to logo +* Link to website +* Professional of enterprise +* # of developers +* Email of contact.sta +* In EU: VAT Number +* In EU: How would you like to pay? IBAN or Payoneer +* In US: How would you like to pay? International wire transfer, or Payoneer (default = payoneer). +* Elders: We’ll get back to you.. +
+ diff --git a/website/templates/supporters.html b/website/templates/supporters.html new file mode 100644 index 00000000..2003a23f --- /dev/null +++ b/website/templates/supporters.html @@ -0,0 +1,10 @@ +<#import "/_scaffold.html" as main> + +<@main.scaffold load=["js/supporters.js"]> + + -- cgit From 2f1a26b6069d6d75729a971be20d45f0fc5fefcc Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 11 Mar 2018 16:57:22 +0100 Subject: [website] added supporters infrastructure. --- build.xml | 6 ++ buildScripts/ivy.xml | 4 +- buildScripts/supporters.ant.xml | 4 +- website/extra/htaccess | 6 ++ website/resources/W8BEN_lombok.pdf | Bin 0 -> 60743 bytes website/resources/css/custom.css | 71 +++++++++++++-- website/resources/js/order-license.js | 139 ++++++++++++++++++++++++++++-- website/resources/js/supporters.js | 13 ++- website/templates/_scaffold.html | 15 ++-- website/templates/contributing.html | 5 ++ website/templates/main.html | 16 ++-- website/templates/order-license-info.html | 25 ++++-- website/templates/order-license.html | 118 ++++++++++++++++++++----- 13 files changed, 357 insertions(+), 65 deletions(-) create mode 100644 website/resources/W8BEN_lombok.pdf (limited to 'website') diff --git a/build.xml b/build.xml index 629db4a6..645114a7 100644 --- a/build.xml +++ b/build.xml @@ -898,6 +898,12 @@ You can also create your own by writing a 'testenvironment.properties' file. The + + + + + + diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml index cf62377e..a27c909e 100644 --- a/buildScripts/ivy.xml +++ b/buildScripts/ivy.xml @@ -58,8 +58,8 @@ - - + + diff --git a/buildScripts/supporters.ant.xml b/buildScripts/supporters.ant.xml index d19e0bb6..d1d3fedc 100644 --- a/buildScripts/supporters.ant.xml +++ b/buildScripts/supporters.ant.xml @@ -39,11 +39,11 @@ containing the status of lombok's supporters. - + - + diff --git a/website/extra/htaccess b/website/extra/htaccess index ea53d49c..db3393af 100644 --- a/website/extra/htaccess +++ b/website/extra/htaccess @@ -24,6 +24,12 @@ RewriteRule ^disable-checked-exceptions$ /disable-checked-exceptions.html [L,END RewriteRule ^disable-checked-exceptions(\.html)?$ /disable-checked-exceptions [NC,R=301] RewriteRule ^contributing$ /contributing.html [L,END] RewriteRule ^contributing(\.html)?$ /contributing [NC,R=301] +RewriteRule ^supporters$ /supporters.html [L,END] +RewriteRule ^supporters(.html)?$ /supporters [NC,R=301] +RewriteRule ^order-license-info$ /order-license-info.html [L,END] +RewriteRule ^order-?license-?info(.html)?$ /order-license-info [NC,R=301] +RewriteRule ^order-license$ /order-license.html [L,END] +RewriteRule ^order-?license(.html)?$ /order-license [NC,R=301] <#list setupPages as pg> RewriteRule ^setup/${pg?no_esc}$ /setup/${pg?no_esc}.html [L,END] diff --git a/website/resources/W8BEN_lombok.pdf b/website/resources/W8BEN_lombok.pdf new file mode 100644 index 00000000..b87bded8 Binary files /dev/null and b/website/resources/W8BEN_lombok.pdf differ diff --git a/website/resources/css/custom.css b/website/resources/css/custom.css index e5bb720e..674d341c 100644 --- a/website/resources/css/custom.css +++ b/website/resources/css/custom.css @@ -7,6 +7,68 @@ margin-bottom: 40px; } +.buttonLike { + cursor: pointer; + background: -webkit-linear-gradient(top, #FFFEF7, #CFCEC7); + background: -moz-linear-gradient(top, #FFFEF7, #CFCEC7); + background: -o-linear-gradient(#FFFEF7, #CFCEC7); + background: -ms-linear-gradient(#FFFEF7, #CFCEC7); + background: linear-gradient(top, #FFFEF7, #CFCEC7); + line-height: 1; + padding: 3px 10px; + border: 1px solid black; + position: relative; + overflow: visible; + color: black; + margin: 2px; + border-radius: 5px; + display: inline-block; + text-align: center; +} + +.orderButton { + width: 280px; +} + +.formErr { + color: #FF7777; +} + +.order-license #deleteCompanyLogo { + margin-top: 12px; +} + +.formSubmitFail { + color: #FF6666; + font-size: 1.2em; + font-style: italic; +} + +.order-license .btn-primary { + float: left; + margin-right: 20px; + background: -webkit-linear-gradient(#1725e0, #0923df 6%, #0b21ce); + background: -o-linear-gradient(#1725e0, #0923df 6%, #0b21ce); + background: -webkit-gradient(linear, left top, left bottom, from(#1725e0), color-stop(6%, #0923df), to(#0b21ce)); + background: linear-gradient(#1725e0, #0923df 6%, #0b21ce); + background-repeat: no-repeat; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1725e0', endColorstr='#ff0b21ce', GradientType=0); + -webkit-filter: none; + filter: none; + border: 1px solid #091bac; +} + +#onlyYearlyWarning { + font-size: 0.8em; + padding-left: 16px; +} + +.deemphasize { + color: #AAAAAA; + font-size: 0.8em; + font-style: italic; +} + .supporterBar .introText { margin-top: 16px; } @@ -24,6 +86,10 @@ display: inline-block; } +.supporters .supportItem { + margin: 6px 10px; +} + .supporterBar { width: 100%; margin-left: auto; @@ -53,11 +119,6 @@ height: 16px; } -.legalese { - font-style: italic; - font-size: 0.8em; -} - #companyLogo { margin-right: 8px; } diff --git a/website/resources/js/order-license.js b/website/resources/js/order-license.js index 82627f2b..4a3edca0 100644 --- a/website/resources/js/order-license.js +++ b/website/resources/js/order-license.js @@ -1,21 +1,140 @@ "use strict"; (function() { + if (!String.prototype.trim) { + String.prototype.trim = function () { + return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + }; + } + var imgDataUrl = null; + + function updateLocationInfo() { + var locationType = $("input:radio[name='locationType']:checked").val(); + $("#locationType_usa").toggle(locationType === "usa"); + $("#locationType_eu").toggle(locationType === "eu"); + $("#locationType_other").toggle(locationType === "other"); + $("#paymentMethod_iban").toggle(locationType === "eu"); + if ($("#paymentMethod_iban input").is(":checked") && locationType !== "eu") $("#paymentMethod_payoneer input").prop("checked", true); + if ($("#paymentMethod_intl input").is(":checked") && locationType === "eu") $("#paymentMethod_iban input").prop("checked", true); + $("#paymentMethod_intl").toggle(locationType !== "eu"); + } + + function updatePriceIndication() { + $("#onlyYearlyWarning").hide(); + var x = getPriceIndication(); + if (x === "") { + $("#costIndicator").text("").hide(); + } else { + $("#costIndicator").text(x).show(); + } + } + + function getPriceIndication() { + try { + var seats = parseInt($("#seats").val()); + if (isNaN(seats)) return ""; + var licenseType = $("input:radio[name='licenseType']:checked").val(); + var costPer; + if (licenseType === "enterprise") costPer = 5; + else if (licenseType === "professional") costPer = 2; + else return ""; + var periodRaw = $("input:radio[name='paymentType']:checked").val(); + if (periodRaw === "monthly") { + if (costPer*seats < 50) { + $("#onlyYearlyWarning").show(); + return "Your license will cost €" + (costPer*seats*12) + ",- per year."; + } + return "Your license will cost €" + (costPer*seats) + ",- per month."; + } + return "Your license will cost €" + (costPer*seats*12) + ",- per year."; + } catch (e) { + return ""; + } + } + + function showError(elemName) { + var elem = $("#" + elemName + "Err"); + elem.fadeIn(); + $("#" + elemName).on("change keyup", function() { + elem.hide(); + }); + } + function applyLicense() { - $("#submit").on("click", function(evt) { + var submitButton = $("#submit"); + var spinner = $("").attr("src", "/img/spinner.gif").attr("alt", "submitting").css("float", "left").css("margin-right", "20px"); + + submitButton.on("click", function(evt) { evt.preventDefault(); var onSuccess = function() { - alert("Form submitted!"); + $("#orderHelp").hide(); + var okMsg = $("
").addClass("formSubmitOk").html("Thank you for ordering a Project Lombok license! We'll send your bill via email. If you have any further questions please contact us at orders@projectlombok.org."); + spinner.replaceWith(okMsg); }; var onFailure = function() { - alert("Whoops"); + $("#orderHelp").hide(); + var errMsg = $("
").addClass("formSubmitFail").html("Our order form appears to be broken. Could you do us a favour and contact us at orders@projectlombok.org? Thank you!"); + spinner.replaceWith(errMsg); }; var data = {}; - data.name = $("#name").val(); + data.name = $("#companyName").val(); + data.email = $("#email").val(); + data.licenseType = $("input:radio[name='licenseType']:checked").val(); + data.seats = parseInt($("#seats").val()); + data.paymentType = $("input:radio[name='paymentType']:checked").val(); + data.mentionMe = $("#mentionMe").prop("checked"); + data.companyUrl = $("#companyUrl").val(); + data.locationType = $("input:radio[name='locationType']:checked").val(); + data.euVat = $("#euVat").val(); + data.paymentMethod = $("input:radio[name='paymentMethod']:checked").val(); + + var formFail = false; + + if (!data.paymentMethod) { + showError("paymentMethod"); + formFail = true; + } + + if (!data.euVat && data.locationType === 'eu') { + $("#euVat").focus(); + showError("euVat"); + formFail = true; + } + + if (!data.locationType) { + showError("locationType"); + formFail = true; + } + + if (!data.seats || isNaN(data.seats)) { + $("#seats").focus(); + showError("seats"); + formFail = true; + } + + if (!data.paymentType) { + showError("paymentType"); + formFail = true; + } + + if (data.email.indexOf('@') === -1) { + $("#email").focus(); + showError("email"); + formFail = true; + } + + if (data.name.trim().length < 1) { + $("#companyName").focus(); + showError("companyName"); + formFail = true; + } + + if (formFail) return; + var rnd = generateRandom(); var err = processImageUpload(); if (err) { @@ -24,6 +143,9 @@ return; } if (imgDataUrl) data.logo = imgDataUrl; + + submitButton.replaceWith(spinner); + $.ajax({ url: "/license-submit/" + rnd, method: "PUT", @@ -31,7 +153,7 @@ data: JSON.stringify(data), processData: false, success: onSuccess, - failure: onFailure + error: onFailure }); }); @@ -58,6 +180,13 @@ $("#deleteCompanyLogo").show(); } }); + + $("#seats,.paymentType,.licenseType").on("change keyup", function() { + updatePriceIndication(); + }); + $(".locationType").on("change", function() { + updateLocationInfo(); + }); } function generateRandom() { diff --git a/website/resources/js/supporters.js b/website/resources/js/supporters.js index 5ec1b057..5f21c79c 100644 --- a/website/resources/js/supporters.js +++ b/website/resources/js/supporters.js @@ -3,7 +3,7 @@ (function($) { var supporters = {}; var weights = {}; - var types = ["patron", "professional", "enterprise"]; + var types = ["enterprise", "professional", "patron"]; function shuffle(array) { var i = 0, j = 0, temp = null; @@ -49,7 +49,7 @@ var d = $("
").addClass("supportItem").addClass(this.type); var a = d; if (this.url) { - a = $("").attr("href", this.url).attr("rel", "noopener"); + a = $("").attr("href", this.url).attr("rel", "noopener").attr("target", "_blank"); d.append(a); } var n = $("").text(this.name); @@ -69,8 +69,13 @@ var ht = Math.round(h / f); i.width = wt; i.height = ht; + var ji = $(i); if (!showName) a.empty(); - a.prepend(i); + ji.css("width", wt + "px"); + ji.css("height", ht + "px"); + ji.attr("alt", n); + ji.attr("title", n); + a.prepend(ji); }; i.src = 'files/' + this.logo; } @@ -129,6 +134,8 @@ var s = $(".supporterBar"); s.find(".introText").show(); s.append($("
").addClass("sbCnt")); + var sf = s.find(".supporterFooter").show(); + s.append(sf); s = s.find(".sbCnt"); var now = new Date(); var list = []; diff --git a/website/templates/_scaffold.html b/website/templates/_scaffold.html index c461423f..767f28e5 100644 --- a/website/templates/_scaffold.html +++ b/website/templates/_scaffold.html @@ -92,14 +92,17 @@ ga('send', 'pageview');
  • Experimental
  • -
  • - - Discuss/Help - +
  • - - Contribute + + Order / Donate
  • <@main.h2 title="Upcoming presentations" />

    - Roel and Reinier will be talking about (near) future java features; a preview of what Java10 and Java11 will probably look like, across germany:

    + Roel and Reinier will be talking about (near) future java features:
    JavaLand March 14th 2018, 12:00, room: Schauspielhaus. +

    See you there! (We'll have stickers!)

    +
    diff --git a/website/templates/order-license-info.html b/website/templates/order-license-info.html index b465eaf0..a58ef913 100644 --- a/website/templates/order-license-info.html +++ b/website/templates/order-license-info.html @@ -9,15 +9,22 @@

    Lombok is open source. We offer three licenses for using lombok. The standard license is free. Here you can order a professional or enterprise license.

    - As part of being a professional or enterprise licensee, we normally offer to put your name, a logo, and possibly a link on our ‘supporters and licensees’ page. From time to time we’ll put a supporter or licensee on our front page. You may of course opt out of this offer. We may, at our discretion, opt not to list you. If we elect not to do so, you will be notified at the email address you fill in on our form, and you are as always free to cancel your license at any time. -

    - The license fee is based on the number of developers that work for you or your company using Project Lombok, per month. The fee is charged in advance. You may choose to pay either monthly or yearly (for sufficiently small licensees, only a yearly option is available). -

    - Project Lombok is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed, even for professional and enterprise license holders. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. -

    - Instead of a professional or enterprise license, if you’d like to support the efforts of Project Lombok, you can also support us via Patreon. -

    - Order a professional or enterprise license now. + Order a professional or enterprise license
    + For individuals: Become a patreon +

    +
    +

    Benefits of becoming a licensee

    +
    +

    + Lombok is and will remain a free, open source product. However, we ask you to consider becoming a licensee. Licensees will be listed on the projectlombok.org website, we'll send you some stickers, and an official license. You'll be supporting the development of Project Lombok. +

    +
    +

    Small print

    +
    +

    + As part of being a professional or enterprise licensee, we will put your name, a logo, and possibly a link on our ‘supporters and licensees’ page. We'll also put (at random) some supporters and licensees on our front page. You may of course opt out of this offer. We may, at our discretion, opt not to list you. If we elect not to do so, you will be notified at the email address you fill in on our form, and you are as always free to cancel your license at any time. +

    + Project Lombok is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed, even for professional and enterprise license holders. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

    diff --git a/website/templates/order-license.html b/website/templates/order-license.html index 4d52d93a..91693c0a 100644 --- a/website/templates/order-license.html +++ b/website/templates/order-license.html @@ -1,7 +1,7 @@ <#import "/_scaffold.html" as main> <@main.scaffold load=["/js/order-license.js"]> -
    -
    -Form fields: - -* EU / US / Elders -* Naam bedrijf -* Do you want to be mentioned? -* Link to logo -* Link to website -* Professional of enterprise -* # of developers -* Email of contact.sta -* In EU: VAT Number -* In EU: How would you like to pay? IBAN or Payoneer -* In US: How would you like to pay? International wire transfer, or Payoneer (default = payoneer). -* Elders: We’ll get back to you.. -
    -- cgit From 9b4bf8334b21393bb0a587ac0a4f0dc342d22bb2 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 11 Mar 2018 17:08:03 +0100 Subject: last minute bugfixes to license order form mechanics. --- website/resources/js/main.js | 2 +- website/resources/js/order-license.js | 4 ++-- website/templates/main.html | 2 +- website/templates/order-license-info.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'website') diff --git a/website/resources/js/main.js b/website/resources/js/main.js index 3ad77958..f07da70d 100644 --- a/website/resources/js/main.js +++ b/website/resources/js/main.js @@ -37,7 +37,7 @@ if (self.data("clc")) return; var href = self.attr("href"); self.data("clc", true); - if (!href || href.substr(0, 4) === "http" || href === "/api/") return; + if (!href || href.substr(0, 4) === "http" || href === "/api/" || href === "/" || href === "/supporters" || href === "/order-license") return; var ext = href.substr(href.length - 4, 4); if (ext === ".xml" || ext === ".jar") return; self.on("click", function(evt) { diff --git a/website/resources/js/order-license.js b/website/resources/js/order-license.js index 4a3edca0..b2842456 100644 --- a/website/resources/js/order-license.js +++ b/website/resources/js/order-license.js @@ -33,7 +33,7 @@ function getPriceIndication() { try { var seats = parseInt($("#seats").val()); - if (isNaN(seats)) return ""; + if (isNaN(seats) || seats < 1) return ""; var licenseType = $("input:radio[name='licenseType']:checked").val(); var costPer; if (licenseType === "enterprise") costPer = 5; @@ -110,7 +110,7 @@ formFail = true; } - if (!data.seats || isNaN(data.seats)) { + if (!data.seats || isNaN(data.seats) || data.seats < 1) { $("#seats").focus(); showError("seats"); formFail = true; diff --git a/website/templates/main.html b/website/templates/main.html index e89557d6..52b3ac0e 100644 --- a/website/templates/main.html +++ b/website/templates/main.html @@ -39,7 +39,7 @@
    diff --git a/website/templates/order-license-info.html b/website/templates/order-license-info.html index a58ef913..724e44f7 100644 --- a/website/templates/order-license-info.html +++ b/website/templates/order-license-info.html @@ -9,7 +9,7 @@

    Lombok is open source. We offer three licenses for using lombok. The standard license is free. Here you can order a professional or enterprise license.

    - Order a professional or enterprise license
    + Order a professional or enterprise license
    For individuals: Become a patreon

    -- cgit From aa8ce194f50be2e521c11bb1a3f5171a8d92f2d5 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 18 Mar 2018 15:02:07 +0100 Subject: [website] Some minor updates and fixes to the website order page. --- website/resources/css/custom.css | 6 ++++++ website/resources/js/supporters.js | 4 ++-- website/templates/order-license.html | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'website') diff --git a/website/resources/css/custom.css b/website/resources/css/custom.css index 674d341c..f81a3dd9 100644 --- a/website/resources/css/custom.css +++ b/website/resources/css/custom.css @@ -30,6 +30,12 @@ width: 280px; } +.orderDetails { + font-style: italic; + font-size: 10px; + margin-top: 20px; +} + .formErr { color: #FF7777; } diff --git a/website/resources/js/supporters.js b/website/resources/js/supporters.js index 5f21c79c..11f77640 100644 --- a/website/resources/js/supporters.js +++ b/website/resources/js/supporters.js @@ -73,8 +73,8 @@ if (!showName) a.empty(); ji.css("width", wt + "px"); ji.css("height", ht + "px"); - ji.attr("alt", n); - ji.attr("title", n); + ji.attr("alt", n.text()); + ji.attr("title", n.text()); a.prepend(ji); }; i.src = 'files/' + this.logo; diff --git a/website/templates/order-license.html b/website/templates/order-license.html index 91693c0a..a364fc79 100644 --- a/website/templates/order-license.html +++ b/website/templates/order-license.html @@ -143,7 +143,8 @@
    -
    If you run into issues with the order form, or you have any other questions, please send us an email at orders@projectlombok.org
    +
    If you run into issues with the order form, or you have any other questions, please send us an email at orders@projectlombok.org. You can cancel your subscription at any time.
    +
    Our EU VAT number: NL858105378B01

    -- cgit From ae611e168718bc226d5ca530484b9a92c2836b30 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 19 Mar 2018 23:43:54 +0100 Subject: [website] Added instruction page about VS Code support in lombok. Updated upcoming talks section. --- website/templates/_scaffold.html | 3 ++- website/templates/main.html | 5 ++--- website/templates/setup/intellij.html | 2 +- website/templates/setup/vscode.html | 18 ++++++++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 website/templates/setup/vscode.html (limited to 'website') diff --git a/website/templates/_scaffold.html b/website/templates/_scaffold.html index 767f28e5..646f0247 100644 --- a/website/templates/_scaffold.html +++ b/website/templates/_scaffold.html @@ -22,7 +22,8 @@ "Netbeans": "netbeans", "MyEclipse": "eclipse", "Spring Tool Suite": "eclipse", - "JBoss Developer Studio": "eclipse" + "JBoss Developer Studio": "eclipse", + "Visual Studio Code": "vscode" }, "Platforms": { "Android": "android", diff --git a/website/templates/main.html b/website/templates/main.html index 52b3ac0e..25098758 100644 --- a/website/templates/main.html +++ b/website/templates/main.html @@ -32,9 +32,8 @@
    <@main.h2 title="Upcoming presentations" />

    - Roel and Reinier will be talking about (near) future java features:
    JavaLand March 14th 2018, 12:00, room: Schauspielhaus. -

    - See you there! (We'll have stickers!) + We're talking to NL-JUG to give a presentation soon in the The Hague (The Netherlands) area.
    + Want us to present at your JUG or conference? Feel free to contact us, via email (info@) or twitter: @project_lombok.

    diff --git a/website/templates/setup/intellij.html b/website/templates/setup/intellij.html index 989986e5..331a7bcd 100644 --- a/website/templates/setup/intellij.html +++ b/website/templates/setup/intellij.html @@ -5,7 +5,7 @@

    The Jetbrains IntelliJ IDEA editor is compatible with lombok.

    - Add the Lombok IntelliJ plugin to add lombok support IntelliJ: + Add the Lombok IntelliJ plugin to add lombok support for IntelliJ:

    • Go to File > Settings > Plugins
    • diff --git a/website/templates/setup/vscode.html b/website/templates/setup/vscode.html new file mode 100644 index 00000000..bf9c3e58 --- /dev/null +++ b/website/templates/setup/vscode.html @@ -0,0 +1,18 @@ +<#import "_setup.html" as s> + +<@s.scaffold title="Microsoft Visual Studio Code"> + <@s.introduction> +

      + The Microsoft Visual Studio Code editor is compatible with lombok. +

      + Add the vscode-lombok plugin to your Visual Studio Code IDE to add lombok support. +

      • + press Ctrl + Shift + X to open the extension manager. +
      • + Type lombok to find the plugin, and click install. +
      • + Reload VS Code when asked. +
      +

      + + -- cgit