Testcontainers-java: OracleContainer extends JdbcDatabaseContainer without generic type

Created on 25 Apr 2019  路  4Comments  路  Source: testcontainers/testcontainers-java

It means I need explicit cast when using methods from super type, eg:

@ClassRule
public static OracleContainer db = (OracleContainer) new OracleContainer("foo")
        .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("db container logger")));

Following screams compilation errors, because #withLogConsumer returns GenericContainer:

@ClassRule
public static OracleContainer db = new OracleContainer("foo")
        .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("db container logger")));
modulejdbc typbug

Most helpful comment

@kiview already submitted: #1425

All 4 comments

Hi @SoftwareTipi,

Have you tried public static OracleContainer db = new OracleContainer<>("foo") as a workaround?

Hi OracleContainer does not have generic type on itself so diamond syntax won't apply to this.
And still this would be workaround.

@SoftwareTipi Yes, you are right. Are you interested in providing a PR?

@kiview already submitted: #1425

Was this page helpful?
0 / 5 - 0 ratings

Related issues

micheal-swiggs picture micheal-swiggs  路  4Comments

dabraham02124 picture dabraham02124  路  3Comments

vmassol picture vmassol  路  3Comments

naderghanbari picture naderghanbari  路  3Comments

denis-zhdanov picture denis-zhdanov  路  3Comments