Fixed type erasure when building with Gradle