1+ /** Provides classes and predicates for reasoning about `java.lang.NumberFormatException`. */
2+
13import java
24
3- /** Calls a string to number conversion */
5+ /** A call to a string to number conversion. */
46private class SpecialMethodAccess extends MethodAccess {
57 predicate isValueOfMethod ( string klass ) {
68 this .getMethod ( ) .getName ( ) = "valueOf" and
@@ -33,7 +35,7 @@ private class SpecialMethodAccess extends MethodAccess {
3335 }
3436}
3537
36- /** Constructs a number from its string representation */
38+ /** A `ClassInstanceExpr` that constructs a number from its string representation. */
3739private class SpecialClassInstanceExpr extends ClassInstanceExpr {
3840 predicate isStringConstructor ( string klass ) {
3941 this .getType ( ) .( RefType ) .hasQualifiedName ( "java.lang" , klass ) and
@@ -51,12 +53,12 @@ private class SpecialClassInstanceExpr extends ClassInstanceExpr {
5153 }
5254}
5355
54- /** The class `java.lang.NumberFormatException` */
56+ /** The class `java.lang.NumberFormatException`. */
5557class NumberFormatException extends RefType {
5658 NumberFormatException ( ) { this .hasQualifiedName ( "java.lang" , "NumberFormatException" ) }
5759}
5860
59- /** Holds if `java.lang.NumberFormatException` is caught */
61+ /** Holds if `java.lang.NumberFormatException` is caught. */
6062predicate catchesNFE ( TryStmt t ) {
6163 exists ( CatchClause cc , LocalVariableDeclExpr v |
6264 t .getACatchClause ( ) = cc and
@@ -65,7 +67,7 @@ predicate catchesNFE(TryStmt t) {
6567 )
6668}
6769
68- /** Holds if `java.lang.NumberFormatException` is thrown */
70+ /** Holds if `java.lang.NumberFormatException` can be thrown. */
6971predicate throwsNFE ( Expr e ) {
7072 e .( SpecialClassInstanceExpr ) .throwsNFE ( ) or e .( SpecialMethodAccess ) .throwsNFE ( )
7173}
0 commit comments