现在的位置: 首页 > 综合 > 正文

Jstyle错误代码对照表

2013年02月23日 ⁄ 综合 ⁄ 共 6175字 ⁄ 字号 评论关闭
                                                             Jstyle错误代码对照表      
错误代码 描述   严重性 参考标准
ST001 类名没有以专用的格式开头,这违反了程序设置。(要设置Jstyle Comment:开头第一个字母要大写) Class name does not start with specified case. This violates the project setting. 1 《指南:java编程规范》7.1.1
ST002 方法名没有以专用的格式开头,这违反了程序设置。(要设置Jstyle Comment:开头第一个字母小写) The method name does not start with specified case. This violates the project setting. 1 《指南:java编程规范》3.1
ST003 数据成员不能是公有的,这违反了数据封装的原则。另外,这样的类不是线程安全的。 Data member should not be public. This violates the principle of data encapsulation. Moreover, such a class is not thread safe. 6 java语言特性
ST004 这个类没有以被推荐的顺序来定义成员。这违反了程序设置。 This class does not declare members in the recommended order. It violates the project setting. 2  
ST005 使用一个空的catch块不是一个好方式。如果你不希望以有意义的方式来处理异常,让它往上到调用者处,例如,将它包括在throws列表中。 Having an empty catch block is not a good idea. If you do not wish to handle the exception in a meaningful way, pass the exception upward to the caller, i.e., include it in the throws list. 7 java语言特性
ST006 一个空的finalize方法是没有用的。如果你不希望为你的类对象执行任何资源清除,完全不要定义一个finalize方法。象这样定义类似的空finalize方法,抑制了基础(base)类的finalization。 An empty finalize method is useless. If you do not wish to perform any resource cleanup for your class objects, do not define a finalize method at all. Defining an empty finalize method such as this, inhibits base class finalization. 3 java语言特性
ST007 空finally块是没有用的。不需以这样的方式来为异常处理定义一个finally块。 Empty finally block is useless. There is no need to define a finally block for the exception handler in this case. 3 java语言特性
ST008 类似于此的空类没有任何用处。查明你是否真的需要它。 An empty class such as this one serves no purpose. Check to see if you really need it. 3 java语言特性
ST009 在‘finally’块中的‘return’的类型使在‘try’块中发现的期望中的‘return’无效。检查这个设计。 The 'return' statement in 'finally' block nullifies the effect of 'return' found within 'try' block. Check this design. 7 java语言特性
ST010 Protected成员在final类中毫无用处。你不能从一个final类中派生! Protected members are not useful in a final class. You cannot derive from a final class! 3 java语言特性
ST011 因为这个类只有私有构造体(constructor),它不能被直接初始化。因此类必须起码有一个非私有静态成员以使它有用处。 Since this class has private constructor(s) only, it cannot be directly instantiated. Hence the class must have at least one non-private static member for it to be useful. 6 java语言特性
ST012 一个抽象类必须包含至少一个抽象方法包括的或者继承的。一个抽象类至少要定义一个抽象方法或是通过继承得到一个,如果你希望阻止这个类对象的实例化,考虑定义一个保护的构造体。 An abstract class must ideally contain at least one abstract method either direct or inherited. If you want to prevent instantiation of this class objects, consider defining a protected constructor. 3 java语言特性
ST013 至少在一些finalize方法的状态中,总是包括一个对super.finalize()的调用。否则,这可能阻止确切的基础的finalization。 Always include a call to super.finalize() as the last statement of any finalize method. Otherwise, this may prevent proper base finalization. 6 java语言特性
ST014 直接地调用finalize()并不改变对象的'gc'状态。你确定想要这么做吗? Explicit call to finalize() does not alter the 'gc' state of the object. Are you sure you want to do this?

5 java语言特性
ST015 如果你catch Throwable, Exception, RuntimeException 或 Error并小心处理它们,在它们非常普遍时。尽可能具体地处理你想要处理的异常并不是一个好方法。 If you catch Throwable, Exception, RuntimeException or Error handle them with care, as they are too general. It is a good idea to be as specific as possible about the exceptions you wish to handle. 5 java语言特性
ST016 如果你catch ThreadDeath,确保你将它throw。否则,此线程不会结束。 If you catch ThreadDeath, ensure that you throw it back. Otherwise, the thread won't die. 7 java语言特性
ST017 如果变量是静态的,将它定义为final变量是个好方法。如果变量是final的,最好定义为静态的 It is a good idea to declare final variables such as this as static. 4 java语言特性
ST018 控制变量必须在'for'的程序体中被改变。检查这个动作是否继续。 The control variable is changed inside the body of the 'for' statement. Check whether this behavior is intended. 3  
ST019 所需要的类名前缀缺失。 The required class name prefix is missing. 1  
ST020 所需的接口名前缀缺失。 The required interface name prefix is missing. 1  
ST021 类的数据成员需要在专用的前缀中定义。 Data members of the class need to be defined with the specified prefix. 1  
ST022 类的函数成员需要在专用的前缀中定义。 The function members of the class need to be defined with the specified prefix. 1  
ST023 接口的数据成员需要在专用的前缀中定义。 The data members of the interface need to be defined with the specified prefix. 1  
ST024 接口的函数成员需要在专用的前缀中定义。 The function members of the interface need to be defined with the specified prefix. 1  
ST025 以一个空体的方法来对一个基础类方法进行override(覆盖)不是一个好的习惯, It is not a good practice to override a base class method, with a method which has an empty body. 4 java语言特性
ST026 接口名字必须以专用的格式开头。 Interface name must start with specified case. 1 《指南:java编程规范》7.2.1
ST027 静态的final 数据成员必须以专用的格式开头。这违反了程序设置。(要设置Jstyle Comment:数据成员要大写) Static final data members must start with specified case. This violates the project setting. 1 《指南:java编程规范》4.1.2
ST028 方法和类使用相同的名字不是一个好办法,因为它有返回类型,它将不会被看作一个构造体,并且因此,可能削弱可读性。 It is not a good idea to have a method with same name as the class. Since it has a return type, it will not be treated as a constructor and hence, can impair readability. 6 java语言特性
ST029 一个空的公有构造体没有用处,这样一个构造体完全不需要被定义。 An empty public constructor serves no purpose. Such a constructor need not be defined at all. 3 java语言特性
ST030 这个执行缺省动作的构造体并不需要。 This constructor is not required, as it implements the default behavior. 3 java语言特性
ST031 这个执行缺省动作的finalize方法并不需要。 This finalize method is not required, as it implements the default behavior. 3 java语言特性
ST032 定义有争议性的finalize方法可能会让人混淆。这个方法将由JVM作为垃圾收集的一部分被自动调用。 Defining a finalize method with arguments can be confusing. This method will not be called automatically by JVM as part of garbage collection. 6 java语言特性
ST033 从你的Throwable中派生异常类不是一个好方法,因为它在继承层级上过高。考虑从Exception或更低的类中派生。 Deriving your exception class from Throwable is not a good idea as it is too high in the hierarchy. Consider deriving from Exception or a class below it. 5 java语言特性
ST034 异常类,如以下这个,从Error或RuntimeException中派生不是在编译时“checked”的并意味着严重的运行时错误。你想要这个动作吗? Exception classes, such as this, derived from Error or RuntimeException are not compile-time "checked" and are meant for serious run-time errors. Do you want this behavior?

5 java语言特性
ST035 在main之外传播一些异常不是一个好方法。不建议将异常扩散出main方法体 It is not a good idea to propagate any exception out of main.

5 java语言特性
ST036 如果一个类只有静态成员,那么它可以通过定义私有或保护构造体来阻止实例化。那么它不利于通过定义私有或保护构造体来阻止实例化。 If a class has only static members, then it is a good idea to prevent instantiation by defining private or protected constructors.

3 java语言特性
ST037 这个公有类没有定义一个公有缺省构造体。这样一个类不允许使用Class.forName(classname).newInstance()的动态对象产生。 This public class does not define a public default constructor. Such a class does not permit dynamic object creation using Class.forName(classname).newInstance(). 4 java语言特性
ST038 从一个非同步的方法或块中调用wait,notify和notifyAll方法可能导致IllegalMonitorState异常。你确定要这样做? wait, notify and notifyAll methods called from a non synchronized method or block may result in IllegalMonitorState exception. Are you sure this is intended? 6 java语言特性
ST039 数据成员名字没有专用的格式开头。这违反了程序设置。 Data member name does not start with specified case. This violates the project setting. 1 《指南:java编程规范》4
ST040 如果一个catch块仅重抛出异常,这个块是不需要的。 If a catch block merely re-throws the exception, the block is unnecessary.

抱歉!评论已关闭.