]> source.dussan.org Git - vaadin-framework.git/commitdiff
Eliminate unguarded Profiler string concatenation
authorLeif Åstrand <leif@vaadin.com>
Wed, 8 Jul 2015 06:23:18 +0000 (09:23 +0300)
committerVaadin Code Review <review@vaadin.com>
Sat, 11 Jul 2015 06:33:23 +0000 (06:33 +0000)
Even though the call to Profiler.enter would be eliminated by the
compiler, it would still include the string concatenation since it can't
prove it wouldn't have any side effects.

Change-Id: Iae3f6d18c409f019d2207d212d00ecb78078bc3e

client/src/com/vaadin/client/ui/AbstractComponentConnector.java

index 24a04384766506cbad910490431df547a39d0add..1f09c14fb0c8e8b631d08f812814baf88075c706 100644 (file)
@@ -103,11 +103,15 @@ public abstract class AbstractComponentConnector extends AbstractConnector
     @Override
     public Widget getWidget() {
         if (widget == null) {
-            Profiler.enter("AbstractComponentConnector.createWidget for "
-                    + getClass().getSimpleName());
+            if (Profiler.isEnabled()) {
+                Profiler.enter("AbstractComponentConnector.createWidget for "
+                        + getClass().getSimpleName());
+            }
             widget = createWidget();
-            Profiler.leave("AbstractComponentConnector.createWidget for "
-                    + getClass().getSimpleName());
+            if (Profiler.isEnabled()) {
+                Profiler.leave("AbstractComponentConnector.createWidget for "
+                        + getClass().getSimpleName());
+            }
         }
 
         return widget;