Bug 73895

Summary: unnecessary cast causing problems
Product: [Tools] AspectJ Reporter: Martin Lippert <mlippert>
Component: CompilerAssignee: Adrian Colyer <adrian.colyer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 1.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Martin Lippert CLA 2004-09-14 13:08:41 EDT
class: org.aspectj.weaver.ResolvedTypeX$Name
method: isCoerceableFrom(..)

I am having trouble with the line:

ResolvedMember[] b = ((Name)other).getDeclaredMethods(); //??? is this cast
always safe

As the comment suggests this cast is NOT always safe. In my case the cast is not
safe because I have some additional implementations for ResolvedTypeX (some
optimizations).

Solution: just remove the cast since the method "getDeclaredMethods" is already
defined abstract in the type of "other" (ResolvedTypeX). So the cast seems to be
obsolete anyway.
Comment 1 Adrian Colyer CLA 2004-10-21 09:54:15 EDT
cast removed. Martin's analysis is correct, and removing this cast cannot do any
harm. Fix is in 1.2.1.