From 455184ef8e9fda89ad0efaedefe1b64a6dfaba08 Mon Sep 17 00:00:00 2001 From: Sami Ekblad Date: Fri, 22 Jul 2016 17:22:53 +0300 Subject: [PATCH] BoV: Updated Java version compatibility notes to Java 8. Change-Id: I8facb7e89af09eec3331c21e04124b5e5827a66e --- .../advanced/advanced-logging.asciidoc | 17 +++++++------ .../application/application-events.asciidoc | 24 ++++++++----------- .../getting-started-idea.asciidoc | 4 ++-- .../installing/installing-toolchain.adoc | 2 +- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/documentation/advanced/advanced-logging.asciidoc b/documentation/advanced/advanced-logging.asciidoc index 12200d32ee..ca0918220d 100644 --- a/documentation/advanced/advanced-logging.asciidoc +++ b/documentation/advanced/advanced-logging.asciidoc @@ -99,16 +99,17 @@ is needed in the class. For example: public class MyClass { private final static Logger logger = Logger.getLogger(MyClass.class.getName()); - + public void myMethod() { try { // do something that might fail } catch (Exception e) { logger.log(Level.SEVERE, "FAILED CATASTROPHICALLY!", e); - } + } } } ---- +ifdef::vaadin7[] ((("static"))) ((("memory @@ -125,13 +126,11 @@ classloader would prevent garbage-collecting the classes after redeploying, hence leaking memory. As the size of the PermGen memory where class object are stored is fixed, the leakage will lead to a server crash after many redeployments. The issue depends on the way how the server manages classloaders, -on the hardness of the back-references, and may also be different between Java 6 -and 7. So, if you experience PermGen issues, or want to play it on the safe -side, you should consider using non-static [classname]#Logger# instances.//As -discussed in Forum thread 1175841 -(24.2.2012). +on the hardness of the back-references. +So, if you experience PermGen issues, or want to play it on the safe +side, you should consider using non-static [classname]#Logger# instances. +//As discussed in Forum thread 1175841 (24.2.2012). +endif::vaadin7[] (((range="endofrange", startref="term.advanced.logging"))) - - diff --git a/documentation/application/application-events.asciidoc b/documentation/application/application-events.asciidoc index 94175d88e7..4b18201d19 100644 --- a/documentation/application/application-events.asciidoc +++ b/documentation/application/application-events.asciidoc @@ -16,8 +16,8 @@ Using anonymous class for listeners is recommended in most cases. [[application.events.anonymous]] == Using Anonymous Classes -By far the easiest and the most common way to handle events in Java 6 and 7 is -to use anonymous local classes. It encapsulates the handling of events to where +By far the easiest and the most common way to handle events in Java 8 lambdas. +It encapsulates the handling of events to where the component is defined and does not require cumbering the managing class with interface implementations. The following example defines an anonymous class that inherits the [classname]#Button.ClickListener# interface. @@ -27,7 +27,7 @@ inherits the [classname]#Button.ClickListener# interface. ---- // Have a component that fires click events final Button button = new Button("Click Me!"); - + // Handle the events with an anonymous class button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { @@ -92,11 +92,11 @@ Directing events to handler methods is easy with method references: ---- public class Java8Buttons extends CustomComponent { public Java8Buttons() { - setCompositionRoot(new HorizontalLayout( + setCompositionRoot(new HorizontalLayout( new Button("OK", this::ok), new Button("Cancel", this::cancel))); } - + public void ok(ClickEvent event) { event.getButton().setCaption ("OK!"); } @@ -126,15 +126,15 @@ public class MyComposite extends CustomComponent public MyComposite() { Layout layout = new HorizontalLayout(); - + // Just a single component in this composition button = new Button("Do not push this"); button.addClickListener(this); layout.addComponent(button); - + setCompositionRoot(layout); } - + // The listener method implementation public void buttonClick(ClickEvent event) { button.setCaption("Do not push this again"); @@ -166,12 +166,12 @@ public class TheButtons extends CustomComponent toobutton = new Button("A Button Too", this); // Put them in some layout - Layout root = new HorizontalLayout(); + Layout root = new HorizontalLayout(); root.addComponent(onebutton); root.addComponent(toobutton); setCompositionRoot(root); } - + @Override public void buttonClick(ClickEvent event) { // Differentiate targets by event source @@ -189,7 +189,3 @@ object properties, names, or captions to separate between them. Using captions or any other visible text is generally discouraged, as it may create problems for internationalization. Using other symbolic strings can also be dangerous, because the syntax of such strings is checked only at runtime. - - - - diff --git a/documentation/getting-started/getting-started-idea.asciidoc b/documentation/getting-started/getting-started-idea.asciidoc index 74f155a6d8..e3e648ff6c 100644 --- a/documentation/getting-started/getting-started-idea.asciidoc +++ b/documentation/getting-started/getting-started-idea.asciidoc @@ -32,7 +32,7 @@ instructed in <