23
23
*/
24
24
25
25
import javax .annotation .Nonnull ;
26
- import sootup .core .model .FullPosition ;
27
26
import sootup .core .model .Position ;
28
27
import sootup .core .util .Copyable ;
29
28
34
33
* @author Linghui Luo, Markus Schmidt
35
34
*/
36
35
public class FullStmtPositionInfo extends SimpleStmtPositionInfo implements Copyable {
37
- protected final FullPosition [] operandPositions ;
36
+ @ Nonnull protected final Position [] operandPositions ;
38
37
39
38
/**
40
39
* Create an instance from given statement position and operand positions.
@@ -43,7 +42,7 @@ public class FullStmtPositionInfo extends SimpleStmtPositionInfo implements Copy
43
42
* @param operandPositions the operand positions
44
43
*/
45
44
public FullStmtPositionInfo (
46
- @ Nonnull Position stmtPosition , @ Nonnull FullPosition [] operandPositions ) {
45
+ @ Nonnull Position stmtPosition , @ Nonnull Position [] operandPositions ) {
47
46
super (stmtPosition );
48
47
this .operandPositions = operandPositions ;
49
48
}
@@ -65,7 +64,7 @@ public Position getStmtPosition() {
65
64
* @return the position of the given operand
66
65
*/
67
66
public Position getOperandPosition (int index ) {
68
- if (this . operandPositions != null && index >= 0 && index < this .operandPositions .length ) {
67
+ if (index >= 0 && index < this .operandPositions .length ) {
69
68
return this .operandPositions [index ];
70
69
} else {
71
70
return NoPositionInformation .getInstance ();
@@ -75,15 +74,10 @@ public Position getOperandPosition(int index) {
75
74
@ Override
76
75
public String toString () {
77
76
StringBuilder s = new StringBuilder ();
78
- s .append ("stmt at: " ). append ( getStmtPosition ()). append ( " \n " );
77
+ s .append (super . toString () );
79
78
s .append ("operands at: " );
80
- if (operandPositions != null ) {
81
- s .append ("\n " );
82
- for (int i = 0 ; i < operandPositions .length ; i ++) {
83
- s .append (i ).append (": " ).append (operandPositions [i ]).append (" " );
84
- }
85
- } else {
86
- s .append ("No position info" );
79
+ for (int i = 0 ; i < operandPositions .length ; i ++) {
80
+ s .append (i ).append (": " ).append (operandPositions [i ]).append (" " );
87
81
}
88
82
return s .toString ();
89
83
}
@@ -94,7 +88,7 @@ public StmtPositionInfo withStmtPosition(@Nonnull Position stmtPosition) {
94
88
}
95
89
96
90
@ Nonnull
97
- public StmtPositionInfo withOperandPositions (@ Nonnull FullPosition [] operandPositions ) {
91
+ public StmtPositionInfo withOperandPositions (@ Nonnull Position [] operandPositions ) {
98
92
return new FullStmtPositionInfo (stmtPosition , operandPositions );
99
93
}
100
94
}
0 commit comments