Compilation error:
error: method does not override or implement a method from a supertype
@Override
error: TestDocumentClipper is not abstract and does not override abstract method copyFromClipboard(DocumentInfo,DocumentStack,Callback,Injector) in DocumentClipper
The above is the compilation error caused by increasing or decreasing the parameters in the method when overriding the method of the parent class in a subclass, or when implementing the interface and overriding the method of the interface in a class
the above error messages are translated as:
1. Method does not override or implement the method in the supertype
2. Testdocumentclipper is not abstract and does not override the abstract method copyfromclipboard (documentinfo, documentstack, callback, injector) in documentclipper
Analysis:
when the documentclipper class implements the methods of the documentclipper interface, it adds (reduces) one more parameter, but there is no corresponding method in the interface to match, so it leads to compilation errors.
Solution:
Add (reduce) the same parameter to the corresponding method in the interface (parent class).
For example, you override the copyfromclipboard() method of the documentclipper interface in the documentclipper class. Because of necessity or carelessness, you add the parameter injector of type injector. The code is as follows:
@Override
public void copyFromClipboard(
DocumentInfo destination,
DocumentStack docStack,
FileOperations.Callback callback,Injector injector){……
At this time, you need to find the copyfromclipboard() method in the documentclipper interface and add the same type of parameters
void copyFromClipboard(
DocumentInfo destination,
DocumentStack docStack,
FileOperations.Callback callback,Injector injector);
Read More:
- Abstract method and static method of java interface
- JAVA: How to use the third-party font library method (using the third-party TTF / TTC font library method)
- [Solved] “status“:405,“error“ Request method ‘POST‘ not supported“
- [Solved] The main method caused an error: Could not deploy Yarn job cluster.
- [Solved] Method threw ‘java.lang.StackOverflowError‘ exception. Cannot evaluate
- Asynchronous processing of HTTP request by Java_ Method 1: through callable
- Asynchronous processing of HTTP request by Java_ Method 2: through deferredresult
- Comparison method violates its general contract [How to Solve]
- [Solved] Error creating bean with name ‘mvcContentNegotiationManager‘: Lookup method resolution failed
- [Solved] Mvel2 Error: java.lang.VerifyError method: getKnownEgressType signature
- Java Web uses AJAX POST Method 405 terror [Solved]
- Java: How to Find the Minimum Value from a Random Array by Bubble Sort Method
- Non empty judgment method: the difference between isnotempty and isnotblank. isNullOrEmpty
- [Solved] Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:
- [Solved] IDEA java Cannot resolve method ‘getName‘ in ***
- Build a mybatis and it will appear session.selectOne Method error
- The controller error: the XX method in the service cannot be found
- [Solved] org.apache.flink.client.program.ProgramInvocationException: The main method caused an error
- [Solved] nested exception is org.apache.ibatis.builder.BuilderException: Error invoking SqlProvider method
- [Solved] Springboot Project Start Error: An attempt was made to call the method com.google.common.collect.Multimaps.asMap