Closed raffig closed 5 years ago
You can use new MySQLContainer<>()
to avoid the warnings.
Testcontainers 2.0 will not use the self-typing anymore. It is being tracked in https://github.com/testcontainers/testcontainers-java/issues/107 and you can find a bit of info here: https://speakerdeck.com/bsideup/geecon-2019-testcontainers-a-year-in-review?slide=74
Diamond operator cannot be used in declaration, so warning remains. It's good to know that it will be changed :-).
I don't see why the containers like MySQLContainer have a type argument though, what is wrong with the following?
public class MySQLContainer extends JdbcDatabaseContainer<MySQLContainer> {
public MySQLContainer withX() {
// configure X
return self();
}
}
This works for me (to avoid the warnings)
MySQLContainer<?> mySQLContainer = new MySQLContainer<>("");
@sanderploegsma You are right with regards to MySQLContainer
, it is there for legacy reasons.
Either I do not see something or there is no purpose for class
org.testcontainers.containers.MySQLContainer
to be generic, and the fact that is generic generates lots of warnings (I don't know what could be provided as SELF parameter).