diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-09-23 08:45:49 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-23 09:45:49 +0300 |
commit | 40d15b32e341a38dacc24cc3ec79ab3ff0a25a50 (patch) | |
tree | ea0f03e7e3b4ed2af1e632065b4c7e8c30eb9d76 /compatibility-server/src | |
parent | d3c752e0f2abec08cd98a66495d1345ad0f56d83 (diff) | |
download | vaadin-framework-40d15b32e341a38dacc24cc3ec79ab3ff0a25a50.tar.gz vaadin-framework-40d15b32e341a38dacc24cc3ec79ab3ff0a25a50.zip |
Construct array inline (#10068)
And some trivial test enhancements
Diffstat (limited to 'compatibility-server/src')
15 files changed, 27 insertions, 26 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/DefaultFieldGroupFieldFactory.java b/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/DefaultFieldGroupFieldFactory.java index 33635004ef..d672ad5b82 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/DefaultFieldGroupFieldFactory.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/DefaultFieldGroupFieldFactory.java @@ -116,9 +116,10 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory { return null; } + @SuppressWarnings("unchecked") private <T extends Field> T createDateField(Class<?> type, Class<T> fieldType) { - AbstractField field; + AbstractField<?> field; if (InlineDateField.class.isAssignableFrom(fieldType)) { field = new InlineDateField(); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java index dd1f28305d..1799bdc72e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java @@ -103,7 +103,7 @@ public class FilesystemContainer implements Container.Hierarchical { } } - private File[] roots = new File[] {}; + private File[] roots = {}; private FilenameFilter filter = null; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java index 4eb44994aa..653ad3f6bf 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java @@ -1766,7 +1766,7 @@ public abstract class AbstractField<T> extends AbstractLegacyComponent @Override public void writeDesign(Element design, DesignContext designContext) { super.writeDesign(design, designContext); - AbstractField def = (AbstractField) designContext + AbstractField<?> def = designContext .getDefaultInstance(this); Attributes attr = design.attributes(); // handle readonly diff --git a/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java b/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java index d0ad569988..62452e974d 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java @@ -107,7 +107,7 @@ public class SerializerHelper { * List of primitive classes. Google App Engine has problems * serializing/deserializing these (#3064). */ - private static final Class<?>[] primitiveClasses = new Class<?>[] { + private static final Class<?>[] primitiveClasses = { byte.class, short.class, int.class, long.class, float.class, double.class, boolean.class, char.class }; diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/PropertyFormatterTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/PropertyFormatterTest.java index 775018642a..2d49ea5275 100644 --- a/compatibility-server/src/test/java/com/vaadin/tests/server/PropertyFormatterTest.java +++ b/compatibility-server/src/test/java/com/vaadin/tests/server/PropertyFormatterTest.java @@ -46,10 +46,10 @@ public class PropertyFormatterTest { @SuppressWarnings({ "rawtypes" }) public void testCorrectTypeForFormat() throws InstantiationException, IllegalAccessException { - Class[] testedTypes = new Class[] { Integer.class, Boolean.class, + Class[] testedTypes = { Integer.class, Boolean.class, Double.class, String.class, Date.class }; - Object[] testValues = new Object[] { new Integer(3), Boolean.FALSE, - new Double(3.3), "bar", new Date() }; + Object[] testValues = { 3, false, + 3.3D, "bar", new Date() }; int i = 0; for (Class class1 : testedTypes) { diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/BeanItemContainerSortTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/BeanItemContainerSortTest.java index d9544e3e82..9ad0c65f1a 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/BeanItemContainerSortTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/BeanItemContainerSortTest.java @@ -45,10 +45,10 @@ public class BeanItemContainerSortTest { } } - String[] names = new String[] { "Antti", "Ville", "Sirkka", "Jaakko", + String[] names = { "Antti", "Ville", "Sirkka", "Jaakko", "Pekka", "John" }; - int[] ages = new int[] { 10, 20, 50, 12, 64, 67 }; - String[] sortedByAge = new String[] { names[0], names[3], names[1], + int[] ages = { 10, 20, 50, 12, 64, 67 }; + String[] sortedByAge = { names[0], names[3], names[1], names[2], names[4], names[5] }; public BeanItemContainer<Person> getContainer() { diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java index d39d604852..4318295547 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java @@ -222,7 +222,7 @@ public class SQLContainerTableQueryTest { RowId two = new RowId(new Object[] { 2 + offset }); RowId three = new RowId(new Object[] { 3 + offset }); if (SQLTestsConstants.db == DB.ORACLE) { - String[] correct = new String[] { "1", "2", "3", "4" }; + String[] correct = { "1", "2", "3", "4" }; List<String> oracle = new ArrayList<String>(); for (Object o : itemIds) { oracle.add(o.toString()); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java index 3346bd245a..f858bde4ac 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java @@ -211,7 +211,7 @@ public class SQLContainerTest { RowId two = new RowId(new Object[] { 2 + offset }); RowId three = new RowId(new Object[] { 3 + offset }); if (SQLTestsConstants.db == DB.ORACLE) { - String[] correct = new String[] { "1", "2", "3", "4" }; + String[] correct = { "1", "2", "3", "4" }; List<String> oracle = new ArrayList<String>(); for (Object o : itemIds) { oracle.add(o.toString()); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToByteConverterTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToByteConverterTest.java index 1ffc7a020e..334114a41a 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToByteConverterTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToByteConverterTest.java @@ -58,7 +58,7 @@ public class StringToByteConverterTest { @Test public void testValueOutOfRange() { - Double[] values = new Double[] { Byte.MAX_VALUE * 2.0, + Double[] values = { Byte.MAX_VALUE * 2.0, Byte.MIN_VALUE * 2.0, Long.MAX_VALUE * 2.0, Long.MIN_VALUE * 2.0 }; diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToIntegerConverterTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToIntegerConverterTest.java index 0cc8e646dc..7d2f9c8d7d 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToIntegerConverterTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToIntegerConverterTest.java @@ -24,7 +24,7 @@ public class StringToIntegerConverterTest { @Test public void testValueOutOfRange() { - Double[] values = new Double[] { Integer.MAX_VALUE * 2.0, + Double[] values = { Integer.MAX_VALUE * 2.0, Integer.MIN_VALUE * 2.0, Long.MAX_VALUE * 2.0, Long.MIN_VALUE * 2.0 }; diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToShortConverterTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToShortConverterTest.java index a2a7332fd1..fed000555c 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToShortConverterTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/data/converter/StringToShortConverterTest.java @@ -58,7 +58,7 @@ public class StringToShortConverterTest { @Test public void testValueOutOfRange() { - Double[] values = new Double[] { Integer.MAX_VALUE * 2.0, + Double[] values = { Integer.MAX_VALUE * 2.0, Integer.MIN_VALUE * 2.0, Long.MAX_VALUE * 2.0, Long.MIN_VALUE * 2.0 }; diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java index 48d6baeaf6..2c14fb9512 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java @@ -234,7 +234,7 @@ public class GridColumnsTest { public void testReorderColumns() { Set<?> containerProperties = new LinkedHashSet<Object>( grid.getContainerDataSource().getContainerPropertyIds()); - Object[] properties = new Object[] { "column3", "column2", "column6" }; + Object[] properties = { "column3", "column2", "column6" }; grid.setColumnOrder(properties); int i = 0; diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/CacheUpdateExceptionCausesTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/CacheUpdateExceptionCausesTest.java index ebe6d37dec..ee3afb1268 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/CacheUpdateExceptionCausesTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/CacheUpdateExceptionCausesTest.java @@ -26,7 +26,7 @@ public class CacheUpdateExceptionCausesTest { @Test public void testSingleCauseException() { Table table = new Table(); - Throwable[] causes = new Throwable[] { + Throwable[] causes = { new RuntimeException("Broken in one way.") }; CacheUpdateException exception = new CacheUpdateException(table, @@ -40,7 +40,7 @@ public class CacheUpdateExceptionCausesTest { @Test public void testMultipleCauseException() { Table table = new Table(); - Throwable[] causes = new Throwable[] { + Throwable[] causes = { new RuntimeException("Broken in the first way."), new RuntimeException("Broken in the second way.") }; diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableColumnAlignmentsTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableColumnAlignmentsTest.java index 11fd3429db..a8cd0bf44a 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableColumnAlignmentsTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableColumnAlignmentsTest.java @@ -28,7 +28,7 @@ public class TableColumnAlignmentsTest { int properties = 5; Table t = TableGeneratorTest.createTableWithDefaultContainer(properties, 10); - Align[] explicitAlignments = new Align[] { Align.CENTER, Align.LEFT, + Align[] explicitAlignments = { Align.CENTER, Align.LEFT, Align.RIGHT, Align.RIGHT, Align.LEFT }; t.setColumnAlignments(explicitAlignments); @@ -40,7 +40,7 @@ public class TableColumnAlignmentsTest { @Test public void invalidColumnAlignmentStrings() { Table t = TableGeneratorTest.createTableWithDefaultContainer(3, 7); - Align[] defaultAlignments = new Align[] { Align.LEFT, Align.LEFT, + Align[] defaultAlignments = { Align.LEFT, Align.LEFT, Align.LEFT }; try { t.setColumnAlignments(new Align[] { Align.RIGHT, Align.RIGHT }); @@ -58,7 +58,7 @@ public class TableColumnAlignmentsTest { @Test public void columnAlignmentForPropertyNotInContainer() { Table t = TableGeneratorTest.createTableWithDefaultContainer(3, 7); - Align[] defaultAlignments = new Align[] { Align.LEFT, Align.LEFT, + Align[] defaultAlignments = { Align.LEFT, Align.LEFT, Align.LEFT }; try { t.setColumnAlignment("Property 1200", Align.LEFT); @@ -82,7 +82,7 @@ public class TableColumnAlignmentsTest { @Test public void invalidColumnAlignmentsLength() { Table t = TableGeneratorTest.createTableWithDefaultContainer(7, 7); - Align[] defaultAlignments = new Align[] { Align.LEFT, Align.LEFT, + Align[] defaultAlignments = { Align.LEFT, Align.LEFT, Align.LEFT, Align.LEFT, Align.LEFT, Align.LEFT, Align.LEFT }; try { @@ -124,10 +124,10 @@ public class TableColumnAlignmentsTest { int properties = 5; Table t = TableGeneratorTest.createTableWithDefaultContainer(properties, 10); - Align[] explicitAlignments = new Align[] { Align.CENTER, Align.LEFT, + Align[] explicitAlignments = { Align.CENTER, Align.LEFT, Align.RIGHT, Align.RIGHT, Align.LEFT }; - Align[] currentAlignments = new Align[] { Align.LEFT, Align.LEFT, + Align[] currentAlignments = { Align.LEFT, Align.LEFT, Align.LEFT, Align.LEFT, Align.LEFT }; for (int i = 0; i < properties; i++) { diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableVisibleColumnsTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableVisibleColumnsTest.java index 5e7fb81848..7190203aa9 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableVisibleColumnsTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TableVisibleColumnsTest.java @@ -8,7 +8,7 @@ import com.vaadin.v7.ui.Table; public class TableVisibleColumnsTest { - String[] defaultColumns3 = new String[] { "Property 0", "Property 1", + String[] defaultColumns3 = { "Property 0", "Property 1", "Property 2" }; @Test @@ -28,7 +28,7 @@ public class TableVisibleColumnsTest { @Test public void explicitVisibleColumns() { Table t = TableGeneratorTest.createTableWithDefaultContainer(5, 10); - Object[] newVisibleColumns = new Object[] { "Property 1", + Object[] newVisibleColumns = { "Property 1", "Property 2" }; t.setVisibleColumns(newVisibleColumns); assertArrayEquals("Explicit visible columns, 5 properties", |