]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove redundant casting
authorPer-Åke Minborg <minborg@speedment.com>
Sat, 29 Oct 2016 05:54:08 +0000 (22:54 -0700)
committerHenri Sara <hesara@vaadin.com>
Sat, 5 Nov 2016 01:56:37 +0000 (03:56 +0200)
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf7232

server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java
server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java
server/src/main/java/com/vaadin/ui/AbstractTextField.java
server/src/main/java/com/vaadin/ui/Button.java
server/src/main/java/com/vaadin/ui/CheckBox.java
server/src/main/java/com/vaadin/ui/Panel.java
server/src/main/java/com/vaadin/ui/TabSheet.java
server/src/main/java/com/vaadin/ui/TextField.java
server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
server/src/test/java/com/vaadin/data/ResultTest.java
server/src/test/java/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java

index 3be9ca668abb3ebb26ac0c52666bda68ab9fe610..3ab5e32d185c09e4941f649d27216170ee849d77 100644 (file)
@@ -510,7 +510,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout
         // write default attributes
         super.writeDesign(design, designContext);
 
-        AbstractOrderedLayout def = (AbstractOrderedLayout) designContext
+        AbstractOrderedLayout def = designContext
                 .getDefaultInstance(this);
 
         writeMargin(design, getMargin(), def.getMargin(), designContext);
index 5f481cb537fb27df1225bde50d52437138be89dc..73bedc8470377cfbffefdef88353406ae4983c0f 100644 (file)
@@ -707,7 +707,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
         super.writeDesign(design, designContext);
         // handle custom attributes (write only if a value is not the
         // default value)
-        AbstractSplitPanel def = (AbstractSplitPanel) designContext
+        AbstractSplitPanel def = designContext
                 .getDefaultInstance(this);
         if (getSplitPosition() != def.getSplitPosition()
                 || !def.getSplitPositionUnit().equals(getSplitPositionUnit())) {
index 714f4b8e64242e12269ed293c5bc578ca7361d7d..3b2c0e9914d37e0fe3421b69a555fc2ffa932dce 100644 (file)
@@ -281,7 +281,7 @@ public abstract class AbstractTextField extends AbstractField<String>
     @Override
     public void writeDesign(Element design, DesignContext designContext) {
         super.writeDesign(design, designContext);
-        AbstractTextField def = (AbstractTextField) designContext
+        AbstractTextField def = designContext
                 .getDefaultInstance(this);
         Attributes attr = design.attributes();
         DesignAttributeHandler.writeAttribute("maxlength", attr, getMaxLength(),
index c4d30c6100576b6c705ada19ca5790963f6df12f..cbd45ba454571cf067f1a09556c8ece64d1ef002 100644 (file)
@@ -621,7 +621,7 @@ public class Button extends AbstractFocusable
     public void writeDesign(Element design, DesignContext designContext) {
         super.writeDesign(design, designContext);
         Attributes attr = design.attributes();
-        Button def = (Button) designContext.getDefaultInstance(this);
+        Button def = designContext.getDefaultInstance(this);
         String content = getCaption();
         if (content != null) {
             design.html(content);
index a0ace0546645326dc4e507bdf570788de47a3514..72d5f9a56c0322f6532fb9e0226b5ed02fa31781 100644 (file)
@@ -207,7 +207,7 @@ public class CheckBox extends AbstractField<Boolean>
     @Override
     public void writeDesign(Element design, DesignContext designContext) {
         super.writeDesign(design, designContext);
-        CheckBox def = (CheckBox) designContext.getDefaultInstance(this);
+        CheckBox def = designContext.getDefaultInstance(this);
         Attributes attr = design.attributes();
         DesignAttributeHandler.writeAttribute("checked", attr, getValue(),
                 def.getValue(), Boolean.class, designContext);
index 7b1333d89810c07f7df4401b4889e742b6d470ed..95dddb000388226ca5107e67d5f7217bdec5988e 100644 (file)
@@ -348,7 +348,7 @@ public class Panel extends AbstractSingleComponentContainer
     public void writeDesign(Element design, DesignContext designContext) {
         super.writeDesign(design, designContext);
         // handle tabindex
-        Panel def = (Panel) designContext.getDefaultInstance(this);
+        Panel def = designContext.getDefaultInstance(this);
     }
 
 }
index cef21eff4954cec7e50b60ccbb15034e37c8864f..91bb3a61fc90d80aa9d072ff56e7765308c69d9d 100644 (file)
@@ -1592,7 +1592,7 @@ public class TabSheet extends AbstractComponentContainer
     @Override
     public void writeDesign(Element design, DesignContext designContext) {
         super.writeDesign(design, designContext);
-        TabSheet def = (TabSheet) designContext.getDefaultInstance(this);
+        TabSheet def = designContext.getDefaultInstance(this);
         Attributes attr = design.attributes();
 
         // write tabs
index b6eec117954afa8cea05b643fa878ff101475d6f..a851eb5e28a17b5eb2a3f83ded2a529ffd1ec865 100644 (file)
@@ -83,7 +83,7 @@ public class TextField extends AbstractTextField {
     @Override
     public void writeDesign(Element design, DesignContext designContext) {
         super.writeDesign(design, designContext);
-        AbstractTextField def = (AbstractTextField) designContext
+        AbstractTextField def = designContext
                 .getDefaultInstance(this);
         Attributes attr = design.attributes();
         DesignAttributeHandler.writeAttribute("value", attr, getValue(),
index 44248d095b587b63815f1bf432b35c9daeb0fb92..00fb32392c02f20cbbc86afdaa1ffced20254752 100644 (file)
@@ -382,7 +382,7 @@ public class DesignAttributeHandler implements Serializable {
             return "";
         }
         @SuppressWarnings("unchecked")
-        Converter<String, Object> converter = (Converter<String, Object>) getFormatter()
+        Converter<String, Object> converter = getFormatter()
                 .findConverterFor(sourceType);
         if (converter != null) {
             return converter.convertToPresentation(value, new ValueContext());
index 2868f745657557c81da271b1c5ada4c527ba661f..53412907cc37490bf413991312ac817ef2db3156 100644 (file)
@@ -51,7 +51,7 @@ public class ResultTest {
     public void of_noException() {
         Result<String> result = Result.of(() -> "", exception -> null);
         Assert.assertTrue(result instanceof SimpleResult);
-        Assert.assertFalse(((SimpleResult<?>) result).isError());
+        Assert.assertFalse(result.isError());
     }
 
     @Test
@@ -61,7 +61,7 @@ public class ResultTest {
             throw new RuntimeException();
         }, exception -> message);
         Assert.assertTrue(result instanceof SimpleResult);
-        Assert.assertTrue(((SimpleResult<?>) result).isError());
+        Assert.assertTrue(result.isError());
         Assert.assertEquals(message, result.getMessage().get());
     }
 
@@ -80,7 +80,7 @@ public class ResultTest {
             return "bar";
         });
         Assert.assertTrue(mapResult instanceof SimpleResult);
-        Assert.assertFalse(((SimpleResult<?>) mapResult).isError());
+        Assert.assertFalse(mapResult.isError());
         mapResult.ifOk(v -> Assert.assertEquals("bar", v));
     }
 
@@ -99,7 +99,7 @@ public class ResultTest {
             return "somevalue";
         });
         Assert.assertTrue(mapResult instanceof SimpleResult);
-        Assert.assertTrue(((SimpleResult<?>) mapResult).isError());
+        Assert.assertTrue(mapResult.isError());
         mapResult.ifError(msg -> Assert.assertEquals("bar", msg));
     }
 }
index a51349205ea9af55ccac848b00391e272327229f..4dcea9e72e3c1ca37e18546fabc7dbcd705d212f 100644 (file)
@@ -86,7 +86,7 @@ public class ClassBasedViewProviderTest {
         ClassBasedViewProvider provider = new ClassBasedViewProvider("test",
                 TestView.class);
         assertNull("Received view name for null view string",
-                provider.getViewName((String) null));
+                provider.getViewName(null));
     }
 
     @Test