J Atkin
J Atkin

Reputation: 3140

Gradle on Travis "no suitable constructor found"

I'm trying to test my project with Travis, and it is proving a fair challenge to do. Right now I'm up against this strange error:

/home/travis/build/JJ-Atkinson/splix-controller-
ppcg/src/main/java/com/nmerrill/kothcomm/ui/gui/TournamentPane.java:62: error: no suitable constructor found for Tab(String,CAP#1)
        Tab tab = new Tab("Game "+games.getTabs().size(),gamePane.apply(game));
                  ^
    constructor Tab.Tab() is not applicable
      (actual and formal argument lists differ in length)
    constructor Tab.Tab(String) is not applicable
      (actual and formal argument lists differ in length)
  where CAP#1 is a fresh type-variable:
    CAP#1 extends Pane from capture of ? extends Pane
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

This is the code:

// gamePane = Function<U, ? extends Pane>
U game = tournamentRunner.createGame();
game.start();
Tab tab = new Tab("Game "+games.getTabs().size(), gamePane.apply(game));

This is a valid constructor, as the code compiles fine on my machine, but something is up with the travis build.

.travis.yml

language: java
jdk:
  - oraclejdk8

script: ./gradlew check

Full file of TournamentPane is here.

Upvotes: 1

Views: 172

Answers (1)

Your problem is caused by an old version of JavaFX on the Travis build system.

The old API did not include a constructor of the Tabclass with two parameters; the new one that you want to use does.

Until Travis upgrades to the current minor JDK version you will have to manually add it to your infrastructure. Have a look at the post "Can you specify minor jdk version for travis ci" for instructions. As the apt repositories used by the Travis infrastructure are often quite outdated (I am however not sure about the specific container you use), I suggest using linuxbrew.

Upvotes: 1

Related Questions