Fix rawtypes warning in build

Fixes #8369
This commit is contained in:
liketic 2017-09-22 11:30:24 +08:00 committed by Armin Braun
parent b4e745ced0
commit a6bd3164a0
7 changed files with 32 additions and 52 deletions

View file

@ -67,7 +67,7 @@ public class AccessorsTest {
@Test
public void testDeepListGet() throws Exception {
Map<Serializable, Object> data = new HashMap<>();
List inner = new ArrayList();
List<String> inner = new ArrayList<>();
data.put("foo", inner);
inner.add("bar");
String reference = "[foo][0]";
@ -79,7 +79,7 @@ public class AccessorsTest {
@Test
public void testAbsentDeepListGet() throws Exception {
Map<Serializable, Object> data = new HashMap<>();
List inner = new ArrayList();
List<String> inner = new ArrayList<>();
data.put("foo", inner);
inner.add("bar");
String reference = "[foo][1]";
@ -94,7 +94,7 @@ public class AccessorsTest {
@Test
public void testInvalidIdList() throws Exception {
final ConvertedMap data = new ConvertedMap(1);
List inner = new ConvertedList(2);
List<Object> inner = new ConvertedList(2);
data.put("map1", inner);
inner.add("obj1");
inner.add("obj2");
@ -137,7 +137,7 @@ public class AccessorsTest {
@Test
public void testDel() throws Exception {
final ConvertedMap data = new ConvertedMap(1);
List inner = new ConvertedList(1);
List<Object> inner = new ConvertedList(1);
data.put("foo", inner);
inner.add("bar");
data.put("bar", "baz");

View file

@ -12,7 +12,7 @@ public class KeyNodeTest {
@Test
public void testNoElementJoin() throws IOException {
assertEquals("", KeyNode.join(new ArrayList(), ","));
assertEquals("", KeyNode.join(new ArrayList<>(), ","));
}
@Test

View file

@ -31,10 +31,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepMapWithString()
throws Exception
{
Map data = new HashMap();
public void testDeepMapWithString() throws Exception {
Map<String, String> data = new HashMap<>();
data.put("foo", "bar");
RubyHash rubyHash = ((RubyHash) Rubyfier.deep(ruby, data));
@ -50,10 +48,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepListWithString()
throws Exception
{
List data = new ArrayList();
public void testDeepListWithString() throws Exception {
List<String> data = new ArrayList<>();
data.add("foo");
RubyArray rubyArray = ((RubyArray)Rubyfier.deep(ruby, data));
@ -71,10 +67,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepMapWithInteger()
throws Exception
{
Map data = new HashMap();
public void testDeepMapWithInteger() throws Exception {
Map<String, Integer> data = new HashMap<>();
data.put("foo", 1);
RubyHash rubyHash = ((RubyHash)Rubyfier.deep(ruby, data));
@ -90,10 +84,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepListWithInteger()
throws Exception
{
List data = new ArrayList();
public void testDeepListWithInteger() throws Exception {
List<Integer> data = new ArrayList<>();
data.add(1);
RubyArray rubyArray = ((RubyArray)Rubyfier.deep(ruby, data));
@ -111,10 +103,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepMapWithFloat()
throws Exception
{
Map data = new HashMap();
public void testDeepMapWithFloat() throws Exception {
Map<String, Float> data = new HashMap<>();
data.put("foo", 1.0F);
RubyHash rubyHash = ((RubyHash)Rubyfier.deep(ruby, data));
@ -130,10 +120,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepListWithFloat()
throws Exception
{
List data = new ArrayList();
public void testDeepListWithFloat() throws Exception {
List<Float> data = new ArrayList<>();
data.add(1.0F);
RubyArray rubyArray = ((RubyArray)Rubyfier.deep(ruby, data));
@ -151,10 +139,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepMapWithDouble()
throws Exception
{
Map data = new HashMap();
public void testDeepMapWithDouble() throws Exception {
Map<String, Double> data = new HashMap<>();
data.put("foo", 1.0D);
RubyHash rubyHash = ((RubyHash)Rubyfier.deep(ruby, data));
@ -170,10 +156,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepListWithDouble()
throws Exception
{
List data = new ArrayList();
public void testDeepListWithDouble() throws Exception {
List<Double> data = new ArrayList<>();
data.add(1.0D);
RubyArray rubyArray = ((RubyArray)Rubyfier.deep(ruby, data));
@ -191,10 +175,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepMapWithBigDecimal()
throws Exception
{
Map data = new HashMap();
public void testDeepMapWithBigDecimal() throws Exception {
Map<String, BigDecimal> data = new HashMap<>();
data.put("foo", new BigDecimal(1));
RubyHash rubyHash = ((RubyHash)Rubyfier.deep(ruby, data));
@ -211,10 +193,8 @@ public class RubyfierTest extends TestBase {
}
@Test
public void testDeepListWithBigDecimal()
throws Exception
{
List data = new ArrayList();
public void testDeepListWithBigDecimal() throws Exception {
List<BigDecimal> data = new ArrayList<>();
data.add(new BigDecimal(1));
RubyArray rubyArray = ((RubyArray)Rubyfier.deep(ruby, data));

View file

@ -93,7 +93,7 @@ public class StringInterpolationTest {
@Test
public void TestValueIsArray() throws IOException {
ArrayList l = new ArrayList();
ArrayList<String> l = new ArrayList<>();
l.add("Hello");
l.add("world");
@ -113,8 +113,8 @@ public class StringInterpolationTest {
}
public Event getTestEvent() {
Map data = new HashMap();
Map inner = new HashMap();
Map<String, Object> data = new HashMap<>();
Map<String, String> inner = new HashMap<>();
inner.put("k1", "v");

View file

@ -131,7 +131,7 @@ public class RecordIOReaderTest {
private void writeSeekAndVerify(final int eventCount, final int expectedSize) throws IOException {
int blocks = (int)Math.ceil(expectedSize / (double)BLOCK_SIZE);
int fillSize = (int) (expectedSize - (blocks * RECORD_HEADER_SIZE));
int fillSize = expectedSize - (blocks * RECORD_HEADER_SIZE);
try(RecordIOWriter writer = new RecordIOWriter(file)){
for (char i = 0; i < eventCount; i++) {
@ -145,7 +145,7 @@ public class RecordIOReaderTest {
Function<byte[], Character> toChar = (b) -> (char) ByteBuffer.wrap(b).get(0);
for (char i = 0; i < eventCount; i++) {
reader.seekToNextEventPosition(i, toChar, Comparator.comparing(o -> ((Character) o)));
reader.seekToNextEventPosition(i, toChar, Comparator.comparing(o -> o));
assertThat(toChar.apply(reader.readEvent()), equalTo(i));
}
}

View file

@ -20,7 +20,7 @@ public class MetricTypeTest {
*/
@Test
public void ensurePassivity(){
Map<MetricType, String> nameMap = new HashMap(EnumSet.allOf(MetricType.class).size());
Map<MetricType, String> nameMap = new HashMap<>(EnumSet.allOf(MetricType.class).size());
nameMap.put(MetricType.COUNTER_LONG, "counter/long");
nameMap.put(MetricType.GAUGE_TEXT, "gauge/text");
nameMap.put(MetricType.GAUGE_BOOLEAN, "gauge/boolean");

View file

@ -108,7 +108,7 @@ public class Concurrent {
public static void oneProducersOneMultipleConsumer() throws IOException, InterruptedException {
final List<StringElement> input = new ArrayList<>();
final Collection<StringElement> output = new ConcurrentLinkedQueue();
final Collection<StringElement> output = new ConcurrentLinkedQueue<>();
final int CONSUMERS = 5;
List<Thread> consumers = new ArrayList<>();