gpt4 book ai didi

Java "method does not override or implement a method from a supertype"错误

转载 作者:行者123 更新时间:2023-11-30 05:44:06 24 4
gpt4 key购买 nike

当我尝试使用 javacgradlew 编译以下代码时

我收到错误方法没有覆盖或实现父类(super class)型@Override的方法两个@Override函数发生错误

如何解决这个问题?

代码.java:

package com.android.commands.locksettings;

import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.os.ShellCallback;

import com.android.internal.os.BaseCommand;
import com.android.internal.widget.ILockSettings;

import java.io.FileDescriptor;
import java.io.PrintStream;

public final class LockSettingsCmd extends BaseCommand {

private static final String USAGE =
"usage: locksettings set-pattern [--old OLD_CREDENTIAL] NEW_PATTERN\n" +
" locksettings set-pin [--old OLD_CREDENTIAL] NEW_PIN\n" +
" locksettings set-password [--old OLD_CREDENTIAL] NEW_PASSWORD\n" +
" locksettings clear [--old OLD_CREDENTIAL]\n" +
"\n" +
"locksettings set-pattern: sets a pattern\n" +
" A pattern is specified by a non-separated list of numbers that index the cell\n" +
" on the pattern in a 1-based manner in left to right and top to bottom order,\n" +
" i.e. the top-left cell is indexed with 1, whereas the bottom-right cell\n" +
" is indexed with 9. Example: 1234\n" +
"\n" +
"locksettings set-pin: sets a PIN\n" +
"\n" +
"locksettings set-password: sets a password\n" +
"\n" +
"locksettings clear: clears the unlock credential\n";

public static void main(String[] args) {
(new LockSettingsCmd()).run(args);
}

@Override
public void onShowUsage(PrintStream out) {
out.println(USAGE);
}

@Override
public void onRun() throws Exception {
ILockSettings lockSettings = ILockSettings.Stub.asInterface(ServiceManager.getService("lock_settings"));
lockSettings.asBinder().shellCommand(FileDescriptor.in, FileDescriptor.out,
FileDescriptor.err, getRawArgs(), new ShellCallback(), new ResultReceiver(null) {});
}
}

最佳答案

通过恢复原始BaseCommand文件解决,感谢@deHaar

关于Java "method does not override or implement a method from a supertype"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55140915/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com