如何解决作为原始类型成员对 'GsonRequest(Params)' 的未检查调用?

How to solve Unchecked call to 'GsonRequest(Params)' as a member of raw type?

我的编辑器收到警告。

Unchecked call to 'GsonRequest(int, String, Class, Map, Listener, ErrorListener)' as a member of raw type 'com.inc.woppi.demoapp.GsonRequest'

GsonRequest class 复制自 Android Dev: https://developer.android.com/training/volley/request-custom.html

下面是我的电话:

// args: url, gson class, response listener, error listener
final GsonRequest gsonRequest = new GsonRequest(
        apiUrl,
        SeatRequestModel.class,
        null,
        new Response.Listener<SeatRequestModel>() {
            @Override
            public void onResponse(SeatRequestModel res) {

                try {
                    boolean errorFound = res.isError();

                    if(errorFound) {
                        //handle error
                    } else {

                        String seatId = res.getData().getSeatId();
                    }

                } catch (Exception e) {
                    Toast.makeText(activityContext, activityContext.getResources().getString(R.string.err_system_response_format_error), Toast.LENGTH_SHORT).show();
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
    @Override
    public void onErrorResponse(VolleyError error) {
        //handle error
    }
}){
    @Override
    protected Map<String,String> getParams(){
        Map<String,String> params = new HashMap<String, String>();

        params.put("from", "australia");
        params.put("to", "canada");

        return params;
    }

    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        Map<String,String> params = new HashMap<String, String>();

        return params;
    }
};

// add the request to the RequestQueue.
VolleySingleton.getInstance(this.getApplicationContext()).addToRequestQueue(gsonRequest);

'Raw type'表示你没有指定类型参数。 final GsonRequest<SeatRequestModel> gsonRequest = new GsonRequest<>( 应该代替 final GsonRequest gsonRequest = new GsonRequest(.