Java min version for master sources?

classic Classic list List threaded Threaded
10 messages Options
julien2412 julien2412
Reply | Threaded
Open this post in threaded view
|

Java min version for master sources?

Hello,

Following
https://cgit.freedesktop.org/libreoffice/core/commit/?id=9ee0a1f16682139c5be28a05d33e980123da4c6f
patch, I got an error build on Win10 with Java 7.
C:\BLP\core\scripting\java\com\sun\star\script\framework\provider\beanshell\PlainSourceView.java:189:
error: no suitable method found for start(String)
                            ta.replaceRange(null, startOffset +
matcher.start("tab"), startOffset + matcher.end("tab"));
                                                                       ^
    method Matcher.start(int) is not applicable
      (actual argument String cannot be converted to int by method
invocation conversion)
    method Matcher.start() is not applicable
      (actual and formal argument lists differ in length)
C:\BLP\core\scripting\java\com\sun\star\script\framework\provider\beanshell\PlainSourceView.java:189:
error: no suitable method found for end(String)
                            ta.replaceRange(null, startOffset +
matcher.start("tab"), startOffset + matcher.end("tab"));
                                                                                                         
^
    method Matcher.end(int) is not applicable
      (actual argument String cannot be converted to int by method
invocation conversion)
    method Matcher.end() is not applicable
      (actual and formal argument lists differ in length)

Indeed, "start" and "end" methods can take a String as argument only from
Java 8.

I mailed Andreas and he indicated me this ongoing patch:
https://gerrit.libreoffice.org/#/c/72666/

Meanwhile, I took a look about prerequisites.
For MacOs, it seems Java min version is 1.8 (see
https://wiki.documentfoundation.org/Development/BuildingOnMac)
On Window, it's 1.7 min (see
https://wiki.documentfoundation.org/Development/BuildingOnWindows)

To simplify all this, can we move to Java 1.8 min for every OS for master
sources? (future 6.3) Or is it too late and we should wait for 6.3 branching
and so it'd be for future 6.4?

Julien



--
Sent from: http://document-foundation-mail-archive.969070.n3.nabble.com/Dev-f1639786.html
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
sberg sberg
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

On 21/05/2019 10:53, julien2412 wrote:
> Meanwhile, I took a look about prerequisites.
> For MacOs, it seems Java min version is 1.8 (see
> https://wiki.documentfoundation.org/Development/BuildingOnMac)
> On Window, it's 1.7 min (see
> https://wiki.documentfoundation.org/Development/BuildingOnWindows)

The baseline is actually Java 6.  We use `javac --target 1.6` (see
JAVA_TARGET_VER in configure.ac) to generate code that is compatible
with the Java 6 JVM spec, and our source code must only use Java API
features that are present in Java 6 (though `javac --source 1.6 --target
1.6` apparently doesn't check that).

> To simplify all this, can we move to Java 1.8 min for every OS for master
> sources? (future 6.3) Or is it too late and we should wait for 6.3 branching
> and so it'd be for future 6.4?

Increasing the baseline should mainly be a compatible change, as old
code (e.g., extensions) should continue to work with newer Java
installations.  The only drawback is that code compiled against the
newer baseline (e.g., the URE jars from our builds being distributed
somewhere on the Maven infrastructure?) cannot be used with older Java
installations.

But with LO 6.3 branch-off just around the corner, I'd make any
discussion of increasing the baseline only target LO 6.4.
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
julien2412 julien2412
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?


...
The baseline is actually Java 6.  We use `javac --target 1.6` (see
JAVA_TARGET_VER in configure.ac) to generate code that is compatible
with the Java 6 JVM spec, and our source code must only use Java API
features that are present in Java 6 (though `javac --source 1.6 --target
1.6` apparently doesn't check that).
...
</>
If we want to be fully compatible with Java 6, would it be possible to make
this patch
https://cgit.freedesktop.org/libreoffice/core/commit/?id=9ee0a1f16682139c5be28a05d33e980123da4c6f
fail locally (even if we use Java 8+ locally) or on Jenkins so it wouldn't
have been pushed?
(Just to put it clearly, I don't blame Andreas, I could have made the same
type of mistake).

Julien



--
Sent from: http://document-foundation-mail-archive.969070.n3.nabble.com/Dev-f1639786.html
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
sberg sberg
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

On 21/05/2019 11:24, julien2412 wrote:

> ...
> The baseline is actually Java 6.  We use `javac --target 1.6` (see
> JAVA_TARGET_VER in configure.ac) to generate code that is compatible
> with the Java 6 JVM spec, and our source code must only use Java API
> features that are present in Java 6 (though `javac --source 1.6 --target
> 1.6` apparently doesn't check that).
> ...
> </>
> If we want to be fully compatible with Java 6, would it be possible to make
> this patch
> https://cgit.freedesktop.org/libreoffice/core/commit/?id=9ee0a1f16682139c5be28a05d33e980123da4c6f
> fail locally (even if we use Java 8+ locally) or on Jenkins so it wouldn't
> have been pushed?

As I wrote, "though `javac --source 1.6 --target 1.6` apparently doesn't
check that".  So I guess to make such mistakes fail locally or for
Gerrit/Jenkins, you would need to actually use Java 6 to build there.
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
sberg sberg
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

In reply to this post by sberg
On 21/05/2019 11:15, Stephan Bergmann wrote:
> Increasing the baseline should mainly be a compatible change, as old
> code (e.g., extensions) should continue to work with newer Java
> installations.  The only drawback is that code compiled against the
> newer baseline (e.g., the URE jars from our builds being distributed
> somewhere on the Maven infrastructure?) cannot be used with older Java
> installations.

...and of course we need to bump the minimal supported versions at
jvmfwk/distributions/OpenOfficeorg/javavendors_*.xml (and bump the
<updated> elements there, which entails the inconveniences discussed at
<https://gerrit.libreoffice.org/plugins/gitiles/core/+/6b8a96c421bc4766ed6c11791174689da86fa703%5E!/>
"Note when javavendors_*.xml <updated> should be updated").

And note that we bumped the baseline to Java 6 only rather recently,
during the LO 6.3 timeframe, see
<https://gerrit.libreoffice.org/plugins/gitiles/core/+/49c21e31ce0501044a7d3602379f74c71dabb00b%5E!/>
"Javavendors: Set minimum version to 1.6" and
<https://lists.freedesktop.org/archives/libreoffice/2019-February/081991.html>
"Minutes of the ESC call 2019-02-07" section "bump java baseline to 1.6
(Samuel, Thorsten)".
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Samuel Mehrbrodt-2 Samuel Mehrbrodt-2
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

Why not have a separate minumum java version for development?

We could require Java 8 for the dev/build machines, but produce java 6 bytecode.

So for end users nothing changes (Java 6 still supported), but developers can make use of new java features.

Samuel

Am 21.05.19 um 11:45 schrieb Stephan Bergmann:
On 21/05/2019 11:15, Stephan Bergmann wrote:
Increasing the baseline should mainly be a compatible change, as old code (e.g., extensions) should continue to work with newer Java installations.  The only drawback is that code compiled against the newer baseline (e.g., the URE jars from our builds being distributed somewhere on the Maven infrastructure?) cannot be used with older Java installations.

...and of course we need to bump the minimal supported versions at jvmfwk/distributions/OpenOfficeorg/javavendors_*.xml (and bump the <updated> elements there, which entails the inconveniences discussed at <https://gerrit.libreoffice.org/plugins/gitiles/core/+/6b8a96c421bc4766ed6c11791174689da86fa703%5E!/> "Note when javavendors_*.xml <updated> should be updated").

And note that we bumped the baseline to Java 6 only rather recently, during the LO 6.3 timeframe, see <https://gerrit.libreoffice.org/plugins/gitiles/core/+/49c21e31ce0501044a7d3602379f74c71dabb00b%5E!/> "Javavendors: Set minimum version to 1.6" and <https://lists.freedesktop.org/archives/libreoffice/2019-February/081991.html> "Minutes of the ESC call 2019-02-07" section "bump java baseline to 1.6 (Samuel, Thorsten)".
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
sberg sberg
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

On 21/05/2019 11:48, Samuel Mehrbrodt wrote:
> Why not have a separate minumum java version for development?
>
> We could require Java 8 for the dev/build machines, but produce java 6
> bytecode.
>
> So for end users nothing changes (Java 6 still supported), but
> developers can make use of new java features.

Not sure I understand you.  How can developers use e.g. Java API
features only present since Java 8 when we target users with Java 6
installations?
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Michael Stahl-3 Michael Stahl-3
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

In reply to this post by Samuel Mehrbrodt-2
On 21.05.19 11:48, Samuel Mehrbrodt wrote:
> Why not have a separate minumum java version for development?
>
> We could require Java 8 for the dev/build machines, but produce java 6
> bytecode.
>
> So for end users nothing changes (Java 6 still supported), but
> developers can make use of new java features.

you could make use of new Java language features, but not new JDK
library features, which was the problem in this case.
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
julien2412 julien2412
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

In reply to this post by sberg
sberg wrote
> ...
> As I wrote, "though `javac --source 1.6 --target 1.6` apparently doesn't
> check that".  So I guess to make such mistakes fail locally or for
> Gerrit/Jenkins, you would need to actually use Java 6 to build there.

Taking a look to
https://opengrok.libreoffice.org/search?project=core&full=JAVA_TARGET_VER&defs=&refs=&path=&hist=&type=&si=full,
I don't see the use of "JAVA_SOURCE_VER" or "JAVA_TARGET_VER" var in
"scripting" part.
But did you mean this kind of line
-Dant.build.javac.target=$(JAVA_TARGET_VER) \ (which obviously must
correspond to add "--target 1.6" to javac)
doesn't actually does its checking work?
Reading
https://stackoverflow.com/questions/15492948/javac-source-and-target-options,
it seems even more complicated since we should use too "bootclasspath"
option too.
Bad news then :-(

Julien






--
Sent from: http://document-foundation-mail-archive.969070.n3.nabble.com/Dev-f1639786.html
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
sberg sberg
Reply | Threaded
Open this post in threaded view
|

Re: Java min version for master sources?

On 21/05/2019 12:06, julien2412 wrote:

> sberg wrote
>> ...
>> As I wrote, "though `javac --source 1.6 --target 1.6` apparently doesn't
>> check that".  So I guess to make such mistakes fail locally or for
>> Gerrit/Jenkins, you would need to actually use Java 6 to build there.
>
> Taking a look to
> https://opengrok.libreoffice.org/search?project=core&full=JAVA_TARGET_VER&defs=&refs=&path=&hist=&type=&si=full,
> I don't see the use of "JAVA_SOURCE_VER" or "JAVA_TARGET_VER" var in
> "scripting" part.

See gb_JavaClassSet_JAVACCOMMAND in solenv/gbuild/JavaClassSet.mk, which
is what gets used by the scripting/Jar_*.mk.

> Reading
> https://stackoverflow.com/questions/15492948/javac-source-and-target-options,
> it seems even more complicated since we should use too "bootclasspath"
> option too.

Ah, right, it was -bootclasspath that would allow javac to check that we
don't use too new Java API features.
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice