vendredi 21 juillet 2017

IllegalAccessError on method reference on Travis

I have following code in one of my tests:

List<Long> wordList = wordService.listAll().stream()
                                         .map(StudiedWord::getId)
                                         .collect(Collectors.toList());

StudiedWord is a POJO with Lombok:

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class StudiedWord extends AbstractModelClass {
    private String text;
    private String translation;
    private WordStage stage;
    private String image;
    private String sound;
}

@Data
@AllArgsConstructor
@NoArgsConstructor
abstract class AbstractModelClass implements ModelObject {
    @Id
    @GeneratedValue
    private Long id;
}

I can run tests from IntelliJ IDEA and everything is OK. I can run tests manually from a terminal using Gradle and again everything is OK.

But on Travis I constantly get following error:

WordSetControllerTest > deleteWordSet FAILED
    java.lang.IllegalAccessError at WordSetControllerTest.java:255

The 255th line is the line with map statement and method reference. If I replace method reference with lambda expression (studiedWord -> studiedWord.getId()) then again everything is fine.

Here is content of my .travis.yml:

language: java
jdk:
  - oraclejdk8

I have other tests where I use method references for other Lombok-generated methods and they work fine.

Is it problems with my Travis configuration or what am I missing?

Aucun commentaire:

Enregistrer un commentaire