lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
944 stars 385 forks source link

Use generic type symbol for type_ in MessageTester class #412

Closed ihilt closed 1 year ago

ihilt commented 1 year ago

Resolves the unchecked call warning below. Unsure whether adding the type.class parameters is necessary but I didn't know of another way to do this.

lcmtest/LcmTestClient.java:138: warning: [unchecked] unchecked call to getConstructor(Class<?>...) as a member of the raw type Class
                msg = (MsgType)type_.getConstructor(DataInput.class).newInstance(ins);
                                                   ^
  where T is a type-variable:
    T extends Object declared in class Class
lcmtest/LcmTestClient.java:138: warning: [unchecked] unchecked cast
                msg = (MsgType)type_.getConstructor(DataInput.class).newInstance(ins);
                                                                                ^
  required: MsgType
  found:    Object
  where MsgType is a type-variable:
    MsgType extends LCMEncodable declared in class LcmTestClient.MessageTester
2 warnings