Coder Social home page Coder Social logo

java-8-11's Introduction

Java Compiler Demo

Demo showing, that the Java compiler cannot detect usage of Java APIs, which are not available on previous Java versions. Instead runtime errors occur, if the execution path leads to a class/method not available in the JRE.

Project Structure

The project consists of two modules:

  • lib: a library, which uses an API available only since Java 11, compiled with JDK 11 but with source and target equal to 8.
  • app: a module, which uses the lib, but is compiled and run with JDK 8.

Running the Project

$ JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 mvn -pl lib clean install

$ JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 mvn -pl app clean verify

The last maven build shows the following error during test run:

Java11ApiExampleTest.test:10 » NoSuchMethod java.util.Optional.isEmpty()Z

java-8-11's People

Watchers

Dimitar Popov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.