Inconsistency between Class.isAssignableFrom() and PsiType.isAssignableFrom()

I'm trying to migrate some code that uses Java types to PsiTypes, and I'm running into inconsistencies between Class.isAssignableFrom() and PsiType.isAssignableFrom(). For example, short.class.isAssignableFrom(byte.class) returns false, whereas PsiType.SHORT.isAssignableFrom(PsiType.BYTE) returns true. Similarly, Object.class.isAssignableFrom(byte.class) returns false, whereas the PsiType equivalent returns true. In both these cases the PsiType result is what I'd intuitively expect, but the discrepancy makes porting Class-based code hard. Is there a method anywhere I can use to get a strict isAssignableFrom that matches the Class version?

Please sign in to leave a comment.