@@ -89,7 +89,7 @@ private void analyzeBinaryWhetehrMathRoot (CtBinaryOperator operatorunderstudy,
89
89
whethermathroot =false ;
90
90
}
91
91
92
- writeGroupedInfo (context , Integer .toString (operatorindex )+"_" +getStringRepr (operatorunderstudy ), CodeFeatures .O5_IS_MATH_ROOT ,
92
+ writeGroupedInfo (context , Integer .toString (operatorindex )+"_" + getSafeStringRepr (operatorunderstudy ), CodeFeatures .O5_IS_MATH_ROOT ,
93
93
whethermathroot , "FEATURES_BINARYOPERATOR" );
94
94
}
95
95
@@ -122,7 +122,7 @@ private void analyzeBinaryLogicalOperator(CtBinaryOperator operatorunderstudy, i
122
122
}
123
123
}
124
124
125
- writeGroupedInfo (context , Integer .toString (operatorindex )+"_" +getStringRepr (operatorunderstudy ), CodeFeatures .O2_LOGICAL_CONTAIN_NOT ,
125
+ writeGroupedInfo (context , Integer .toString (operatorindex )+"_" + getSafeStringRepr (operatorunderstudy ), CodeFeatures .O2_LOGICAL_CONTAIN_NOT ,
126
126
whethercontainnotoperator , "FEATURES_BINARYOPERATOR" );
127
127
128
128
}
@@ -167,7 +167,7 @@ private void analyzeBinaryOperatorKind(CtBinaryOperator operatorunderstudy, int
167
167
for (int index =0 ; index <binoperatortype .size (); index ++) {
168
168
CodeFeatures cerainfeature = binoperatortype .get (index );
169
169
170
- final String operatorunderstudyStr = getStringRepr (operatorunderstudy );
170
+ final String operatorunderstudyStr = getSafeStringRepr (operatorunderstudy );
171
171
if (cerainfeature .toString ().endsWith (operatorstring .toUpperCase ()))
172
172
writeGroupedInfo (context , Integer .toString (operatorindex )+"_" + operatorunderstudyStr , cerainfeature ,
173
173
true , "FEATURES_BINARYOPERATOR" );
@@ -176,7 +176,7 @@ else writeGroupedInfo(context, Integer.toString(operatorindex)+"_"+ operatorund
176
176
}
177
177
}
178
178
179
- public static String getStringRepr (CtElement operatorunderstudy ) {
179
+ public static String getSafeStringRepr (CtElement element ) {
180
180
// workaround for
181
181
// at spoon.support.reflect.reference.CtTypeReferenceImpl.getAccessType(CtTypeReferenceImpl.java:774)
182
182
// at spoon.reflect.visitor.ImportAnalyzer$ScannerListener.enter(ImportAnalyzer.java:135)
@@ -214,7 +214,7 @@ public static String getStringRepr(CtElement operatorunderstudy) {
214
214
// at java.base/java.lang.StringConcatHelper.stringOf(StringConcatHelper.java:453)
215
215
216
216
try {
217
- return operatorunderstudy .toString ();
217
+ return element .toString ();
218
218
} catch (Exception e ) {
219
219
// fake string, please open an issue if this is a problem
220
220
return "FIXME_oefa" ;
@@ -229,12 +229,12 @@ private void analyzeBinaryOperatorInvolveNull(CtBinaryOperator operatorunderstud
229
229
CtExpression leftexpression = operatorunderstudy .getLeftHandOperand ();
230
230
CtExpression rightexpression = operatorunderstudy .getRightHandOperand ();
231
231
232
- final String leftStr = getStringRepr (leftexpression );
233
- final String rightStr = getStringRepr (rightexpression );
232
+ final String leftStr = getSafeStringRepr (leftexpression );
233
+ final String rightStr = getSafeStringRepr (rightexpression );
234
234
if (leftStr .trim ().equals ("null" ) || rightStr .trim ().equals ("null" ))
235
235
whethercontainnull = true ;
236
236
237
- writeGroupedInfo (context , Integer .toString (operatorindex )+"_" +getStringRepr (operatorunderstudy ), CodeFeatures .O3_CONTAIN_NULL ,
237
+ writeGroupedInfo (context , Integer .toString (operatorindex )+"_" + getSafeStringRepr (operatorunderstudy ), CodeFeatures .O3_CONTAIN_NULL ,
238
238
whethercontainnull , "FEATURES_BINARYOPERATOR" );
239
239
240
240
}
@@ -248,16 +248,16 @@ private void analyzeBinaryOperatorInvolve01 (CtBinaryOperator operatorunderstudy
248
248
CtExpression leftexpression = operatorunderstudy .getLeftHandOperand ();
249
249
CtExpression rightexpression = operatorunderstudy .getRightHandOperand ();
250
250
251
- final String leftStr = getStringRepr (leftexpression );
252
- final String rightStr = getStringRepr (rightexpression );
251
+ final String leftStr = getSafeStringRepr (leftexpression );
252
+ final String rightStr = getSafeStringRepr (rightexpression );
253
253
if (leftStr .trim ().equals ("0" ) || leftStr .trim ().equals ("0.0" ) ||
254
254
leftStr .trim ().equals ("1.0" ) || leftStr .trim ().equals ("1" )
255
255
|| rightStr .trim ().equals ("0" ) || rightStr .trim ().equals ("0.0" ) ||
256
256
rightStr .trim ().equals ("1.0" ) || rightStr .trim ().equals ("1" )
257
257
|| leftStr .trim ().endsWith ("1" ) || rightStr .trim ().endsWith ("1" ))
258
258
whethercontain01 = true ;
259
259
260
- writeGroupedInfo (context , Integer .toString (operatorindex )+"_" +getStringRepr (operatorunderstudy ), CodeFeatures .O3_CONTAIN_01 ,
260
+ writeGroupedInfo (context , Integer .toString (operatorindex )+"_" + getSafeStringRepr (operatorunderstudy ), CodeFeatures .O3_CONTAIN_01 ,
261
261
whethercontain01 , "FEATURES_BINARYOPERATOR" );
262
262
}
263
263
@@ -274,7 +274,7 @@ private void analyzeBinaryOperatorCompareInCondition (CtElement wholeoriginal, C
274
274
whethercompareincondition = true ;
275
275
}
276
276
277
- writeGroupedInfo (context , Integer .toString (operatorindex )+"_" +getStringRepr (operatorunderstudy ), CodeFeatures .O4_COMPARE_IN_CONDITION ,
277
+ writeGroupedInfo (context , Integer .toString (operatorindex )+"_" + getSafeStringRepr (operatorunderstudy ), CodeFeatures .O4_COMPARE_IN_CONDITION ,
278
278
whethercompareincondition , "FEATURES_BINARYOPERATOR" );
279
279
}
280
280
}
0 commit comments