Maven compiler plugin configured with Java 7 but still compiles Java 8 code
<p>In my project, we are going to use Java 7 for <code>maven-compiler-plugin</code> and we assume that after Maven compile, all the code which is using Java 8 should not compile successfully.  </p>

<p>However, in my case, there is a file using <code>Arrays.stream(T[] array)</code> which can be used from Java 8 and it still compiles successfully. Below is some of the <code>pom.xml</code> file which configure the Java version. Would you please have a look and give me any idea why my files can still compile successfully although I configure it to be Java 7?</p>

<p>For the <code>pom.xml</code>, I skip the dependencies and so on and only list the properties and the build.</p>

<pre><code>&lt;properties&gt;
    &lt;java.version&gt;1.7&lt;/java.version&gt;
&lt;/properties&gt;
&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
            &lt;version&gt;${maven-compiler-plugin.version}&lt;/version&gt;
            &lt;configuration&gt;
                &lt;source&gt;${java.version}&lt;/source&gt;
                &lt;target&gt;${java.version}&lt;/target&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt; 
</code></pre>

<p>And for the file I use a method in Java 8, the line is something like this:</p>

<pre><code>buffer.append(Arrays.stream(arg).collect(Collectors.joining("/")));
</code></pre>

<p>And what I want is that since I configure the Java version to be 7 in Maven and after compile, the file which use the Java 8 should not compile successfully and show the errors like "... are allowed only at source level 1.8 or above".</p>