Java 名称';航班号';必须匹配模式'^[a-z][a-zA-Z0-9]*$&x27;
在我的程序上运行checkstyle时,我不断遇到此错误:Java 名称';航班号';必须匹配模式'^[a-z][a-zA-Z0-9]*$&x27;,java,javadoc,checkstyle,Java,Javadoc,Checkstyle,在我的程序上运行checkstyle时,我不断遇到此错误: NonRefundable.java:20:28: Name 'flight_Num' must match pattern '^[a-z][a-zA-Z0-9]*$'. 我不确定我需要做什么来纠正这个问题。以下是针对此特定错误的注释: /** Comments. * * @param flight_Num the flight number. * @param trip_Data the information
NonRefundable.java:20:28: Name 'flight_Num' must match pattern '^[a-z][a-zA-Z0-9]*$'.
我不确定我需要做什么来纠正这个问题。以下是针对此特定错误的注释:
/** Comments.
*
* @param flight_Num the flight number.
* @param trip_Data the information stored in the Itinerary object.
* @param base_Fare the double representing the initial cost of the trip.
* @param fare_AdjustmentFactor the number factored into the baseFare and
discountFactor used to calculate totalFare.
* @param discount_Factor the number factored into baseFare and
* fare_AdjustmentFactor to calculate totalFare.
*/
NonRefundable(String flight_Num, Itinerary trip_Data, double base_Fare,
double fare_AdjustmentFactor, double discount_Factor) {
super(flight_Num, trip_Data, base_Fare, fare_AdjustmentFactor);
this.discountFactor = discount_Factor;
}
名称“航班号”必须与模式“^[a-z][a-zA-Z0-9]*$”匹配
表示不允许使用flight Num中的uu字符。您可能需要查看checkstyle文档,我希望您在解决第一个问题时会看到这一点,但要从参数名称中删除下划线
NonRefundable(String flightNum, Itinerary tripData, double baseFare,
double fareAdjustmentFactor, double discountFactor)
您可以查看各种样式指南,参数名称往往采用驼峰式大小写,如本文所示
如果无法删除下划线,则可以使用以下方法抑制此操作:
// SUPPRESS CHECKSTYLE ParameterName
NonRefundable(...)
如果不允许,您将如何重命名此变量?@IgorGanapolsky您如何重命名带有上述错误的常量?就连我也面临着同样的错误