Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

Frameworks & Java8

Andreas Eberle edited this page Jan 4, 2017 · 2 revisions

Because we are currently supporting Android down to version 4.0.3 (API level 15), we cannot use the "new" Java8 features in the code shared between the Android and the PC version of the game. This affects the following submodules:

  • go.graphics
  • go.graphics.android
  • jsettlers.common
  • jsettlers.graphics
  • jsettlers.graphics.androidui
  • jsettlers.logic
  • jsettlers.main.android
  • jsettlers.network

In order to still be able to use lambda expressions and Java8 style streams, the frameworks retrolambda and streamsupport are used.

Retrolambda

Retrolambda allows us to use "lambda expressions, method references and try-with-resources statements" by converting the compiled Java8 bytecode. As this step is automatically applied during compilation, you should not see any differences in comparision to using Java8 directly.

Streamsupport

The streamsupport library offers the Java8 streams for non-Java8 users. However, as the library cannot change the API of the used Java version, the methods cannot always be used in the absolut same way. Therefore, I highly recommend to have a look at the Streamsupport "documentation".