Last active
May 12, 2018 10:42
-
-
Save lWeRl/265fdaf062b9707de462b8dd3c03aa69 to your computer and use it in GitHub Desktop.
GenericHell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Collection; | |
import java.util.Collections; | |
public class GenHell { | |
class Model {} | |
class BillingReserve<T extends Model> { | |
BillingReserve(Collection<Long> ids) { | |
} | |
} | |
<T extends Model> void makeHell(Collection<T> col) { | |
Collection<Long> one = Collections.singleton(1L); | |
new BillingReserve(col); //compile WTF | |
new BillingReserve<>(col); //non-compile | |
new BillingReserve<>(one); //compile | |
new BillingReserve<Model>(col); //non-compile | |
new BillingReserve<Model>(one); //compile model not needed | |
new BillingReserve<T>(col); //non-compile | |
new BillingReserve<T>(one); //compile | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment