From: Per-Åke Minborg Date: Sat, 29 Oct 2016 05:54:08 +0000 (-0700) Subject: Remove redundant casting X-Git-Tag: 8.0.0.alpha7~16 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=399d7cd5c498b67da9c244ffa7135e872b1507b6;p=vaadin-framework.git Remove redundant casting Change-Id: I80b73b653e97904605dc62484a7448f3bfbf7232 --- diff --git a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java index 3be9ca668a..3ab5e32d18 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java @@ -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); diff --git a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java index 5f481cb537..73bedc8470 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java @@ -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())) { diff --git a/server/src/main/java/com/vaadin/ui/AbstractTextField.java b/server/src/main/java/com/vaadin/ui/AbstractTextField.java index 714f4b8e64..3b2c0e9914 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractTextField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractTextField.java @@ -281,7 +281,7 @@ public abstract class AbstractTextField extends AbstractField @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(), diff --git a/server/src/main/java/com/vaadin/ui/Button.java b/server/src/main/java/com/vaadin/ui/Button.java index c4d30c6100..cbd45ba454 100644 --- a/server/src/main/java/com/vaadin/ui/Button.java +++ b/server/src/main/java/com/vaadin/ui/Button.java @@ -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); diff --git a/server/src/main/java/com/vaadin/ui/CheckBox.java b/server/src/main/java/com/vaadin/ui/CheckBox.java index a0ace05466..72d5f9a56c 100644 --- a/server/src/main/java/com/vaadin/ui/CheckBox.java +++ b/server/src/main/java/com/vaadin/ui/CheckBox.java @@ -207,7 +207,7 @@ public class CheckBox extends AbstractField @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); diff --git a/server/src/main/java/com/vaadin/ui/Panel.java b/server/src/main/java/com/vaadin/ui/Panel.java index 7b1333d898..95dddb0003 100644 --- a/server/src/main/java/com/vaadin/ui/Panel.java +++ b/server/src/main/java/com/vaadin/ui/Panel.java @@ -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); } } diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index cef21eff49..91bb3a61fc 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -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 diff --git a/server/src/main/java/com/vaadin/ui/TextField.java b/server/src/main/java/com/vaadin/ui/TextField.java index b6eec11795..a851eb5e28 100644 --- a/server/src/main/java/com/vaadin/ui/TextField.java +++ b/server/src/main/java/com/vaadin/ui/TextField.java @@ -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(), diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java index 44248d095b..00fb32392c 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -382,7 +382,7 @@ public class DesignAttributeHandler implements Serializable { return ""; } @SuppressWarnings("unchecked") - Converter converter = (Converter) getFormatter() + Converter converter = getFormatter() .findConverterFor(sourceType); if (converter != null) { return converter.convertToPresentation(value, new ValueContext()); diff --git a/server/src/test/java/com/vaadin/data/ResultTest.java b/server/src/test/java/com/vaadin/data/ResultTest.java index 2868f74565..53412907cc 100644 --- a/server/src/test/java/com/vaadin/data/ResultTest.java +++ b/server/src/test/java/com/vaadin/data/ResultTest.java @@ -51,7 +51,7 @@ public class ResultTest { public void of_noException() { Result 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)); } } diff --git a/server/src/test/java/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java b/server/src/test/java/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java index a51349205e..4dcea9e72e 100644 --- a/server/src/test/java/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java +++ b/server/src/test/java/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java @@ -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