Error: anonymous class is not abstract and does not override abstract method

Error: anonymous class is not abstract and does not override abstract method

拜托,每当我尝试构建我的 android 项目时,下面的方法都会出错。

方法:

query.findInBackground(new FindCallback() {
            @Override
            public void done(List<ParseObject> objects, ParseException e) {
                mProgressBar.setVisibility(View.INVISIBLE);

                if (e == null) {
                    objects = removeCurrentUser(objects);
                    mUsers = objects.toArray(new ParseObject[0]);

                    // Get user relations
                    ParseRelation userRelations = ParseUser.getCurrentUser().getRelation("UserRelation");
                    userRelations.getQuery().findInBackground(new FindCallback() {
                        @Override
                        public void done(List<ParseObject> results, ParseException e) {
                            if (e == null) {
                                UsersAdapter adapter = new UsersAdapter(SelectUsersActivity.this, mUsers, new ArrayList<ParseObject>(results));
                                setListAdapter(adapter);
                            }
                            else {
                                Log.e(TAG, "Exception caught!", e);
                            }
                        }
                    });
                }
                else {
                    // Something went wrong.
                    Toast.makeText(SelectUsersActivity.this, "Sorry, there was an error getting users!", Toast.LENGTH_LONG).show();
                }
            }
        }//
         );

错误:

Error:(46, 45) error: is not abstract and does not override abstract method done(List,ParseException) in FindCallback

Error:(48, 16) error: name clash: done(List,ParseException) in and done(List,ParseException) in FindCallback have the same erasure, yet neither overrides the other where T is a type-variable: T extends ParseObject declared in interface FindCallback

这里是Screenshot

您没有参数化您的匿名 FindCallback 子类,因此您的 done 签名与 FindCallback#done 签名不匹配,因为 done 签名在 un-parameterized 版本是 done(List<Object>results, ParseException e).

要修复它,请对其进行参数化:

userRelations.getQuery().findInBackground(new FindCallback<ParseObject>() {
// Add ---------------------------------------------------^^^^^^^^^^^^^