cushon / issues-import

0 stars 0 forks source link

CollectionIncompatibleType throwing exceptions. #222

Closed cushon closed 9 years ago

cushon commented 9 years ago

Original issue created by radoslaw.burny on 2013-12-17 at 12:41 AM


CollectionIncompatibleType is throwing exceptions on some tricky cases (which I discovered while compiling Maven with errorprone). I've prepared testcases to showcase these problems - see attached patch. I've also did some debugging; here's what exactly is happening in testcases and why:

1) CollectionIncompatibleTypeOutOfBounds.java CollectionIncompatibleType heuristically assumes that the class implementing generic collection interface takes type parameters identical to said collection (i.e. HashMap<K, V> implements Map<K, V>); hence it tries to read those parameters. But for non-generic implementations (i.e. Properties implements Map<Object, Object>), this will cause IndexOutOfBoundsException.

2) CollectionIncompatibleTypeClassCast.java CollectionIncompatibleType uses Suppliers.receiverInstance() to find method call receiver. This will fail with ClassCastException for calls with implicit "this" receiver.

Both of the exceptions happen in argCastableToMethodReceiverTypeParam helper.

cushon commented 9 years ago

Original comment posted by amshali@google.com on 2013-12-17 at 02:37 AM


Thanks for the bug report. Will fix soon.


Status: Accepted Owner: amshali@google.com

cushon commented 9 years ago

Original comment posted by eaftan@google.com on 2014-03-04 at 01:00 AM


Amin, have you had a chance to look at this?

cushon commented 9 years ago

Original comment posted by amshali@google.com on 2014-03-04 at 01:04 AM


No, but I will by the end of this week. Unless this is it is urgent, then someone else must take over because I am very busy right now.

ΛMIN シ | Grok Team | amshali@ <amshali@google.com> | Google Inc.

cushon commented 9 years ago

Original comment posted by eaftan@google.com on 2014-03-04 at 04:16 AM


That's fine, no rush.

cushon commented 9 years ago

Original comment posted by amshali@google.com on 2014-03-21 at 12:03 AM


Fix on its way.

cushon commented 9 years ago

Original comment posted by amshali@google.com on 2014-03-25 at 01:24 AM


This issue was closed by revision a1a18e98a13b.


Status: Fixed

cushon commented 9 years ago

Original comment posted by amshali@google.com on 2014-03-25 at 06:03 PM


Thank you for your elaborate bug report. I used your provided test data to make sure we are doing the right thing. If you could, please verify that this works for you.