Skip to content

Commit 0fb6dcb

Browse files
committed
deleted unused import statements and added @SuppressWarnings annotations in org.msgpack.template.*.java
1 parent 65325af commit 0fb6dcb

11 files changed

Lines changed: 17 additions & 13 deletions

src/main/java/org/msgpack/template/AnyTemplate.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525

2626

2727
public class AnyTemplate<T> extends AbstractTemplate<T> {
28+
@SuppressWarnings("rawtypes")
2829
private static AnyTemplate INSTANCE = null;
2930

31+
@SuppressWarnings("rawtypes")
3032
public static AnyTemplate getInstance(TemplateRegistry registry) {
3133
if (INSTANCE == null) {
3234
INSTANCE = new AnyTemplate(registry);
@@ -40,6 +42,7 @@ private AnyTemplate(TemplateRegistry registry) {
4042
this.registry = registry;
4143
}
4244

45+
@SuppressWarnings("unchecked")
4346
public void write(Packer pk, T target, boolean required) throws IOException {
4447
if(target instanceof Value) {
4548
pk.write((Value) target);

src/main/java/org/msgpack/template/CharacterTemplate.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.msgpack.packer.Packer;
2323
import org.msgpack.unpacker.Unpacker;
2424

25-
2625
/**
2726
* CharacterTemplate<br/>
2827
*

src/main/java/org/msgpack/template/GenericCollectionTemplate.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222

2323

2424
public class GenericCollectionTemplate implements GenericTemplate {
25+
@SuppressWarnings("rawtypes")
2526
Constructor<? extends Template> constructor;
2627

28+
@SuppressWarnings("rawtypes")
2729
public GenericCollectionTemplate(TemplateRegistry registry, Class<? extends Template> tmpl) {
2830
try {
2931
constructor = tmpl.getConstructor(new Class<?>[]{ Template.class });
@@ -39,9 +41,10 @@ public GenericCollectionTemplate(TemplateRegistry registry, Class<? extends Temp
3941
}
4042
}
4143

44+
@SuppressWarnings("rawtypes")
4245
public Template build(Template[] params) {
4346
try {
44-
return constructor.newInstance(params);
47+
return constructor.newInstance((Object[]) params);
4548
} catch (InvocationTargetException e) {
4649
throw new IllegalArgumentException(e);
4750
} catch (IllegalAccessException e) {

src/main/java/org/msgpack/template/GenericMapTemplate.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222

2323

2424
public class GenericMapTemplate implements GenericTemplate {
25+
@SuppressWarnings("rawtypes")
2526
Constructor<? extends Template> constructor;
2627

28+
@SuppressWarnings("rawtypes")
2729
public GenericMapTemplate(TemplateRegistry registry, Class<? extends Template> tmpl) {
2830
try {
2931
constructor = tmpl.getConstructor(new Class<?>[] { Template.class, Template.class });
@@ -40,9 +42,10 @@ public GenericMapTemplate(TemplateRegistry registry, Class<? extends Template> t
4042
}
4143
}
4244

45+
@SuppressWarnings("rawtypes")
4346
public Template build(Template[] params) {
4447
try {
45-
return constructor.newInstance(params);
48+
return constructor.newInstance((Object[]) params);
4649
} catch (InvocationTargetException e) {
4750
throw new IllegalArgumentException(e);
4851
} catch (IllegalAccessException e) {

src/main/java/org/msgpack/template/GenericTemplate.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919

2020

2121
public interface GenericTemplate {
22+
@SuppressWarnings("rawtypes")
2223
public Template build(Template[] params);
2324
}

src/main/java/org/msgpack/template/ObjectArrayTemplate.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.msgpack.unpacker.Unpacker;
99

1010

11+
@SuppressWarnings({ "rawtypes", "unchecked" })
1112
public class ObjectArrayTemplate extends AbstractTemplate {
1213
protected Class componentClass;
1314

src/main/java/org/msgpack/template/TemplateReference.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public TemplateReference(TemplateRegistry registry, Type targetType) {
3838
this.targetType = targetType;
3939
}
4040

41+
@SuppressWarnings("unchecked")
4142
private void validateActualTemplate() {
4243
if (actualTemplate == null) {
4344
actualTemplate = (Template<T>) registry.cache.get(targetType);

src/main/java/org/msgpack/template/TemplateRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.msgpack.type.Value;
5454

5555

56+
@SuppressWarnings({ "rawtypes", "unchecked" })
5657
public class TemplateRegistry {
5758

5859
private TemplateRegistry parent = null;
@@ -220,7 +221,6 @@ public synchronized Template lookup(Type targetType) {
220221
"Cannot find template for " + targetClass + " class. Try to add @Message annotation to the class or call MessagePack.register(Type).");
221222
}
222223

223-
@SuppressWarnings("unchecked")
224224
private Template<Type> lookupGenericType(Type targetType) {
225225
Template<Type> tmpl = null;
226226
if (targetType instanceof ParameterizedType) {

src/main/java/org/msgpack/template/Templates.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.msgpack.type.Value;
2828

2929

30+
@SuppressWarnings({ "rawtypes", "unchecked" })
3031
public final class Templates {
3132
public static final Template<Value> TValue = ValueTemplate.getInstance();
3233

@@ -58,7 +59,6 @@ public final class Templates {
5859

5960
public static final Template<Date> TDate = DateTemplate.getInstance();
6061

61-
6262
public static <T> Template<T> tNotNullable(Template<T> innerTemplate) {
6363
return new NotNullableTemplate(innerTemplate);
6464
}

src/test/java/org/msgpack/template/TestTemplates.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
import java.util.ArrayList;
1414

1515
import org.msgpack.MessagePack;
16-
import org.msgpack.packer.Packer;
1716
import org.msgpack.packer.BufferPacker;
1817
import org.msgpack.unpacker.Unpacker;
19-
import org.msgpack.unpacker.BufferUnpacker;
2018

2119
import static org.msgpack.template.Templates.*;
2220

@@ -28,6 +26,7 @@ public static enum MyEnum {
2826
A, B, C;
2927
}
3028

29+
@SuppressWarnings("unused")
3130
@Test
3231
public void testGenericsTypesCompliable() throws IOException {
3332
Template<Byte> tbyte = TByte;

0 commit comments

Comments
 (0)