It won't always work. Read a blog post detailing the problem once but can't
find it right now.
Looking at
http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html#A999198
there's a list of behavioural changes

On Thu, Nov 27, 2014, 22:33 Igor Fedorenko <i...@ifedorenko.com> wrote:

> Out of curiosity, why do you want to get exactly the same bytecode? Does
> the code compiled with java8 not work under java7?
>
> --
> Regards,
> Igor
>
> On 2014-11-27, 15:39, Mark Struberg wrote:
> > Hi!
> >
> > Today I had a discussion with Robert about how we can solve a problem I
> had over at Apache OpenWebBeans:
> >
> > https://issues.apache.org/jira/browse/OWB-952
> >
> > As a short summary: the classes provided in rt.jar of Java8 are slightly
> different than the ones from Java7 and 6. Similar big differences have been
> seen in the Java4 to 5 transition.
> > Thus if you compile your project with Java8 you might get different
> bytecode than when compiling with Java7 JDK. Even if you use target=1.7 in
> both cases.
> >
> > There are 2 options: either use javac -bootclasspath and point it to the
> 'correct' rt.jar + other jdk libs, or just switch the whole environment.
> >
> > Roberts suggestion was to use the Maven Toolchain system:
> http://maven.apache.org/plugins/maven-toolchains-plugin/
> > http://maven.apache.org/plugins/maven-toolchains-
> plugin/toolchains/jdk.html
> >
> >
> > We also elaborated about improving the Toolchain lookup in our
> maven-compiler-plugin:
> > http://maven.apache.org/plugins/maven-compiler-plugin/
> xref/org/apache/maven/plugin/compiler/AbstractCompilerMojo.html#427
> >
> > This could get improved to first check if a toolchain is registered for
> the <target> version used in the m-compiler-p. And if there is no toolchain
> configured especially for this version then we fallback to the one if we
> don't specify a version.
> > The effective lookup path would then be
> > 1.) toolchain configured via maven-toolchain-plugin
> > 2.) toolchain with specified target version
> > 3.) default toolchain
> >
> >
> > I think we would need to slightly enhance the ToolchainManager, but
> first would like to get some feedback.
> >
> >
> > LieGrue,
> > strub
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> > For additional commands, e-mail: dev-h...@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>

Reply via email to