@@ -333,7 +333,9 @@ protected AbstractLocalVariable searchLocalVariable(int index, int offset) {
333333 }
334334
335335 public boolean isCompatible (AbstractLocalVariable lv , Type valueType ) {
336- if (valueType .isObject () && (lv .getType ().getDimension () == valueType .getDimension ())) {
336+ if (valueType == ObjectType .TYPE_UNDEFINED_OBJECT ) {
337+ return true ;
338+ } else if (valueType .isObject () && (lv .getType ().getDimension () == valueType .getDimension ())) {
337339 ObjectType valueObjectType = (ObjectType ) valueType ;
338340
339341 if (lv .getType ().isObject ()) {
@@ -389,33 +391,6 @@ public AbstractLocalVariable getLocalVariableInAssignment(Map<String, BaseType>
389391 return lv ;
390392 }
391393
392- public AbstractLocalVariable getLocalVariableInCastAssignment (Map <String , BaseType > typeBounds , int index , int offset , Type castType , Type valueType ) {
393- AbstractLocalVariable lv = searchLocalVariable (index , offset );
394-
395- if (lv == null ) {
396- // Create a new local variable
397- createLocalVariableVisitor .init (index , offset );
398- valueType .accept (createLocalVariableVisitor );
399- lv = createLocalVariableVisitor .getLocalVariable ();
400- } else if (lv .isAssignableFrom (typeBounds , castType ) || isCompatible (lv , castType )) {
401- // Assignable, reduce type
402- lv .typeOnRight (typeBounds , castType );
403- } else if (lv .isAssignableFrom (typeBounds , valueType ) || isCompatible (lv , valueType )) {
404- // Assignable, reduce type
405- lv .typeOnRight (typeBounds , valueType );
406- } else if (!lv .getType ().isGeneric () || (ObjectType .TYPE_OBJECT != valueType )) {
407- // Not assignable -> Create a new local variable
408- createLocalVariableVisitor .init (index , offset );
409- valueType .accept (createLocalVariableVisitor );
410- lv = createLocalVariableVisitor .getLocalVariable ();
411- }
412-
413- lv .setToOffset (offset );
414- store (lv );
415-
416- return lv ;
417- }
418-
419394 public AbstractLocalVariable getLocalVariableInNullAssignment (int index , int offset , Type valueType ) {
420395 AbstractLocalVariable lv = searchLocalVariable (index , offset );
421396
0 commit comments