2012-11-01 72 views
0

我一直当我在我的程序运行的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 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; 
    } 

回答

1

Name 'flight_Num' must match pattern '^[a-z][a-zA-Z0-9]*$'

意味着flight_Num,_字符是不允许的。

+0

如果它不允许,那么你将如何重新命名这个变量? –

1

您可能需要查看checkstyle文档,我希望您在修复第一个问题时会看到此内容,但从参数名称中删除下划线。

NonRefundable(String flightNum, Itinerary tripData, double baseFare, 
     double fareAdjustmentFactor, double discountFactor) 

http://checkstyle.sourceforge.net/config_naming.html

你可以看一下不同风格指南和参数名往往是骆驼套管,如在这个特殊的一个。

http://www.cwu.edu/~gellenbe/javastyle/parameter.html

相关问题