Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-5067

Make Flink compile with 1.8 Java compiler

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.3.0
    • Component/s: Build System
    • Labels:
      None
    • Environment:

      macOS Sierra 10.12.1, java version "1.8.0_112", Apache Maven 3.3.9

      Description

      Flink fails to compile when using 1.8 as source and target in Maven. There are two types of issue that are both related to the new type inference rules:

      • Call to TypeSerializer.copy method in TupleSerializer.java:112 now resolves to a different overload than before causing a compilation error: [ERROR] /Users/andrey.melentyev/Dev/github.com/apache/flink/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializer.java:[112,63] incompatible types: void cannot be converted to java.lang.Object
      • A number of unit tests using assertEquals fail to compile:
        [ERROR] /Users/andrey.melentyev/Dev/github.com/apache/flink/flink-java/src/test/java/org/apache/flink/api/common/operators/CollectionExecutionAccumulatorsTest.java:[50,25] reference to assertEquals is ambiguous
        [ERROR] both method assertEquals(long,long) in org.junit.Assert and method assertEquals(java.lang.Object,java.lang.Object) in org.junit.Assert match

      In both of the above scenarios explicitly casting one of the arguments helps the compiler to resolve overloaded method call correctly.

      It is possible to maintain Flink's code base in a state when it can be built by both 1.7 and 1.8. For this purpose we need minor code fixes and an automated build in Travis to keep the new good state.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                melentye Andrey Melentyev
                Reporter:
                melentye Andrey Melentyev
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: