KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > options > SMBOptions


1
2 /* Soot - a J*va Optimization Framework
3  * Copyright (C) 2003 Ondrej Lhotak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */

20
21 /* THIS FILE IS AUTO-GENERATED FROM soot_options.xml. DO NOT MODIFY. */
22
23 package soot.options;
24 import java.util.*;
25
26 /** Option parser for Static Method Binder. */
27 public class SMBOptions
28 {
29     private Map options;
30
31     public SMBOptions( Map options ) {
32         this.options = options;
33     }
34     
35     /** Enabled --
36     
37      * .
38     
39      *
40      */

41     public boolean enabled() {
42         return soot.PhaseOptions.getBoolean( options, "enabled" );
43     }
44     
45     /** Insert Null Checks --
46     
47      * .
48     
49      * Insert a check that, before invoking the static copy of the
50      * target method, throws a NullPointerException if the receiver
51      * object is null. This ensures that static method binding does
52      * not eliminate exceptions which would have occurred in its
53      * absence.
54      */

55     public boolean insert_null_checks() {
56         return soot.PhaseOptions.getBoolean( options, "insert-null-checks" );
57     }
58     
59     /** Insert Redundant Casts --
60     
61      * .
62     
63      * Insert extra casts for the Java bytecode verifier. If the
64      * target method uses its this parameter, a reference to the
65      * receiver object must be passed to the static copy of the target
66      * method. The verifier may complain if the declared type of the
67      * receiver parameter does not match the type implementing the
68      * target method. Say, for example, that Singer is an interface
69      * declaring the sing() method and that the call graph shows all
70      * receiver objects at a particular call site, singer.sing() (with
71      * singer declared as a Singer) are in fact Bird objects (Bird
72      * being a class that implements Singer). The virtual call
73      * singer.sing() is effectively replaced with the static call
74      * Bird.staticsing(singer). Bird.staticsing() may perform
75      * operations on its parameter which are only allowed on Birds,
76      * rather than Singers. The Insert Redundant Casts option inserts
77      * a cast of singer to the Bird type, to prevent complaints from
78      * the verifier.
79      */

80     public boolean insert_redundant_casts() {
81         return soot.PhaseOptions.getBoolean( options, "insert-redundant-casts" );
82     }
83     
84     public static final int allowed_modifier_changes_unsafe = 1;
85     public static final int allowed_modifier_changes_safe = 2;
86     public static final int allowed_modifier_changes_none = 3;
87     /** Allowed Modifier Changes --
88     
89      * .
90     
91      * Specify which changes in visibility modifiers are allowed.
92      */

93     public int allowed_modifier_changes() {
94         String JavaDoc s = soot.PhaseOptions.getString( options, "allowed-modifier-changes" );
95         
96         if( s.equalsIgnoreCase( "unsafe" ) )
97             return allowed_modifier_changes_unsafe;
98         
99         if( s.equalsIgnoreCase( "safe" ) )
100             return allowed_modifier_changes_safe;
101         
102         if( s.equalsIgnoreCase( "none" ) )
103             return allowed_modifier_changes_none;
104         
105         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option allowed-modifier-changes" );
106     }
107     
108 }
109         
Popular Tags