@@ -209,7 +209,10 @@ private Set<Abstraction> computeAliases(final DefinitionStmt defStmt, Value left
209209 ArrayRef arrayRef = (ArrayRef ) leftValue ;
210210 newType = TypeUtils .buildArrayOrAddDimension (newType , arrayRef .getType ().getArrayType ());
211211 } else if (defStmt .getRightOp () instanceof ArrayRef ) {
212- newType = ((ArrayType ) newType ).getElementType ();
212+ if (newType instanceof ArrayType )
213+ newType = ((ArrayType ) newType ).getElementType ();
214+ else
215+ newType = null ;
213216 } else {
214217 // Type check
215218 if (!manager .getTypeUtils ().checkCast (source .getAccessPath (), leftValue .getType ()))
@@ -318,17 +321,19 @@ else if (defStmt.getRightOp() instanceof LengthExpr) {
318321 targetType = TypeUtils .buildArrayOrAddDimension (targetType ,
319322 arrayRef .getType ().getArrayType ());
320323 } else if (leftValue instanceof ArrayRef ) {
321- assert source .getAccessPath ().getBaseType () instanceof ArrayType ;
322- targetType = ((ArrayType ) targetType ).getElementType ();
323-
324324 // If we have a type of java.lang.Object, we try
325325 // to tighten it
326326 if (TypeUtils .isObjectLikeType (targetType ))
327327 targetType = rightValue .getType ();
328+ else if (targetType instanceof ArrayType )
329+ targetType = ((ArrayType ) targetType ).getElementType ();
330+ else
331+ targetType = null ;
328332
329333 // If the types do not match, the right side
330334 // cannot be an alias
331- if (!manager .getTypeUtils ().checkCast (rightValue .getType (), targetType ))
335+ if (targetType != null
336+ && !manager .getTypeUtils ().checkCast (rightValue .getType (), targetType ))
332337 addRightValue = false ;
333338 }
334339 }
0 commit comments