Java 8 compatibility
Gilles Duboscq
gilwooden at gmail.com
Fri Apr 24 10:00:21 UTC 2015
Hello Stefan,
I am working on a change where i took a different approach: i added a
--relax-compliance flag (the reverse of your --release flag) as well as a
RELAX_COMPLIANCE environment variable (to be able to keep it on).
It does not change the compliance of the projects (so eclipse and javac
still know which version of the language you want to use) but it just
allows you to build against a newer JDK (i.e. it will not check that you're
not using newer APIs).
If we really think this should be the default behaviour I can swap it
around and make it a --strict-compliance flag.
I don't think this is really about releases, as soon as you're developing
you want the checks to be there because they don't cost you anything and it
makes developing easier: usages of wrong API will be detected immediately.
Also, if you're developing Graal or Truffle you certainly have a JDK 7 just
because you get the same benefits in your IDE: you will not get
auto-completion for APIs you can't use.
– Gilles
On Fri, Apr 24, 2015 at 11:10 AM Stefan Marr <java at stefan-marr.de> wrote:
> Hi Thomas:
>
> > On 04 Apr 2015, at 23:59, Thomas Wuerthinger <
> thomas.wuerthinger at oracle.com> wrote:
> >
> > We would be interested in a patch like you specify below. The only hard
> requirement we have is that our gate checks (“mx gate”) need to continue to
> make sure that projects related to the Truffle API can be built with Java 7.
>
> I would propose something like the patch below.
> The idea is to have an additional flag, perhaps `--release`, which is used
> to enforce the Java compliance levels strictly.
> I guess, it would also be necessary for the gate command to set the
> do_release flag to true implicitly.
>
> So, the main result of this change is that a casual user can build Graal
> and Truffle easily with only a single JDK available.
> I tested it with JDK8u45, and Graal, Truffle, as well as IGV work nicely.
>
> Would that be something that could make it into Graal?
>
>
> Best regards
> Stefan
>
>
> diff --git a/mx/mx_graal.py b/mx/mx_graal.py
> index 8b33dcf..8ca4636 100644
> --- a/mx/mx_graal.py
> +++ b/mx/mx_graal.py
> @@ -2570,6 +2570,7 @@ def mx_init(suite):
> mx.add_argument('--vmprefix', action='store', dest='vm_prefix',
> help='prefix for running the VM (e.g. "/usr/bin/gdb --args")',
> metavar='<prefix>')
> mx.add_argument('--gdb', action='store_const',
> const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix
> "/usr/bin/gdb --args"')
> mx.add_argument('--lldb', action='store_const', const='lldb --',
> dest='vm_prefix', help='alias for --vmprefix "lldb --"')
> + mx.add_argument('--release', action='store_true',
> dest='do_release', help='Enforce Java version compliance for release build')
>
> commands.update({
> 'export': [export, '[-options] [zipfile]'],
> diff --git a/mxtool/mx.py b/mxtool/mx.py
> index 0a12e8a..38fe930 100755
> --- a/mxtool/mx.py
> +++ b/mxtool/mx.py
> @@ -209,7 +209,7 @@ class Distribution:
> elif dep.isProject():
> p = dep
>
> - if self.javaCompliance:
> + if self.javaCompliance and _opts.do_release:
> if p.javaCompliance > self.javaCompliance:
> abort("Compliance level doesn't match:
> Distribution {0} requires {1}, but {2} is {3}.".format(self.name,
> self.javaCompliance, p.name, p.javaCompliance))
>
> @@ -310,9 +310,11 @@ class Project(Dependency):
> # Verify that a JDK exists for this project if its compliance
> level is
> # less than the compliance level of the default JDK
> jdk = java(self.javaCompliance)
> - if jdk is None and self.javaCompliance < java().javaCompliance:
> + if jdk is None and self.javaCompliance < java().javaCompliance
> and _opts.do_release:
> abort('Cannot find ' + str(self.javaCompliance) + ' JDK
> required by ' + name + '. ' +
> 'Specify it with --extra-java-homes option or
> EXTRA_JAVA_HOMES environment variable.')
> + elif not _opts.do_release:
> + self.javaCompliance = java().javaCompliance
>
> # Create directories for projects that don't yet exist
> if not exists(d):
>
>
>
>
>
> --
> Stefan Marr
> INRIA Lille - Nord Europe
> http://stefan-marr.de/research/
>
>
>
>
More information about the graal-dev
mailing list