Duplicate code blocks in sonar for import statements in Java
•
Java
On sonar 4.5 6 (default setting), I see the message duplicated blocks as
The Java code of the message I received is as follows: –
package com.jabong.orchestratorservice.adapter.order.endpoints;
import com.jabong.orchestratorservice.adapter.order.request.UpdateOrderStatusReadyShipRequest;
public class UpdateOrderReadyShipEndPoint extends BaSEOrderEndPoint {
private final static String API_NAME = "setStatusToReadyToShip";
@Override
public String getSourceEndPoint() {
return new StringBuilder("direct:").append(API_NAME).toString();
}
@Override
public String getDestinationEndPoint() {
return new StringBuilder("bean:orderHelper?method=").append(API_NAME).toString();
}
@Override
protected String getName() {
return API_NAME;
}
@Override
protected String getApiInputClassName() {
return UpdateOrderStatusReadyShipRequest.class.getName();
}
}
Updateorderstatusreadyshiprequest also does not import updateorderreadyshipendpoint
package com.jabong.orchestratorservice.adapter.order.request;
public class UpdateOrderStatusReadyShipRequest extends BaSEOrderRequest {
Can someone tell me what this means?
Solution
The repeat block rule can cause problems at the file level Therefore, it is not intended to tell you that the import statement is repeated, but that there is a duplicate block somewhere in the file If you scroll down, you will see a vertical yellow / orange bar on the left edge It marks repeated blocks Click this column to get details of the block copy location
Edit in the most recent version, the copy is marked brown or gray
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
