You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Emmanuel Bourg <eb...@apache.org> on 2019/05/08 20:30:55 UTC

Re: javax.tools based JSP compiler

Hi all,

I've rebased the javax.tools JSP compiler on top of the current master
branch :

  https://github.com/ebourg/tomcat/tree/jasper-javax-tools-support

Please let me know how you feel about this stuff and if it's worth merging.

Emmanuel Bourg


Le 09/04/2018 à 17:28, Emmanuel Bourg a écrit :
> 
> I've just completed an initial implementation:
> 
>   https://github.com/ebourg/tomcat/commit/1272a1b
> 
> I tested with Java 8 and 10 on Windows and it worked fine with the JSP
> examples shipped with Tomcat. It allowed me to use the new 'var' syntax
> with Java 10.
> 
> Unlike ECJ the javax.tools API cannot take an existing ClassLoader but
> expects a list of files. So it is probably slower, and I guess it
> doesn't support non unpacked war files. The javax.tools API also
> requires the JDK (the JRE has the API but not the underlying
> implementation).
> 
> So this compiler is quite equivalent to the Ant based compiler, but at
> least it doesn't require an additional jar.
> 
> Emmanuel Bourg
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: javax.tools based JSP compiler

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 13/05/2019 à 12:17, Mark Thomas a écrit :

> If I am understanding this all correctly, the proposed way forward is to
> (eventually) replace the Ant compiler with the JSR199 based Javac
> compiler? If so, then +1 from me.

I mostly aim at providing an easy way to use the new language features
in JSPs, removing the legacy Ant compiler is a bonus. This perspective
raises a couple of questions:

- When the Ant compiler could be deprecated/removed? Should we deprecate
in Tomcat 9.0.x and remove in 10, or deprecate in Tomcat 10 and remove
in 11?

- What should be done with the JspServlets configured to use Ant once
the compiler is deprecated/removed? Throw an error or redirect to the
new javac compiler?

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: javax.tools based JSP compiler

Posted by Mark Thomas <ma...@apache.org>.
On 11/05/2019 21:23, Emmanuel Bourg wrote:
> Le 11/05/2019 à 00:46, Emmanuel Bourg a écrit :
> 
>> - I'm not sure about the performance, ECJ was known to be faster than
>> javac in the past but I don't know if it's still true today.
> 
> I ran a quick test on an old Core 2 Duo with a SSD, compiling Tomcat and
> another Ant based project of mine. The Eclipse compiler is still faster
> than javac, by ~40%.

Thanks for all the explanations.

The performance testing is also interesting.

If I am understanding this all correctly, the proposed way forward is to
(eventually) replace the Ant compiler with the JSR199 based Javac
compiler? If so, then +1 from me.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: javax.tools based JSP compiler

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 11/05/2019 à 00:46, Emmanuel Bourg a écrit :

> - I'm not sure about the performance, ECJ was known to be faster than
> javac in the past but I don't know if it's still true today.

I ran a quick test on an old Core 2 Duo with a SSD, compiling Tomcat and
another Ant based project of mine. The Eclipse compiler is still faster
than javac, by ~40%.

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: javax.tools based JSP compiler

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 09/05/2019 à 00:34, Mark Thomas a écrit :

> +1
> 
> Need to remove the @author tags and add some info on how to configure
> jasper to use them.

Ok will do.


> A few daft questions:
> 
> 1. If we used the JSR199Complier by default would that allow us to
> remove the Eclipse compiler as a dependency?

The JSR199 compiler has some drawbacks :
- It requires a full JDK (the Eclipse compiler just needs a JRE). This
will be less of an issue in the future since there is no JRE anymore
after Java 8.
- It doesn't reuse an existing classloader, it builds its classpath from
a list of files. I haven't checked if it works with non-expanded war
files, but I guess it doesn't. And it's probably slower (but that may be
negligible compared to the compilation time).
- I'm not sure about the performance, ECJ was known to be faster than
javac in the past but I don't know if it's still true today.

So no I don't think it can replace the Eclipse compiler yet.


> 2. Why would anyone use the JavacCompiler in preference to JSR199Complier?

The JSR199 compiler will indeed render the Ant based one obsolete. It'll
make javac directly usable without the Ant dependency.

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: javax.tools based JSP compiler

Posted by Mark Thomas <ma...@apache.org>.
On 08/05/2019 21:58, Rémy Maucherat wrote:
> On Wed, May 8, 2019 at 10:31 PM Emmanuel Bourg <eb...@apache.org> wrote:
> 
>> Hi all,
>>
>> I've rebased the javax.tools JSP compiler on top of the current master
>> branch :
>>
>>   https://github.com/ebourg/tomcat/tree/jasper-javax-tools-support
>>
>> Please let me know how you feel about this stuff and if it's worth merging.
>>
> Ok, so it feels like a win over Ant, so it should be merged, but I didn't
> test it.

+1

Need to remove the @author tags and add some info on how to configure
jasper to use them.

A few daft questions:

1. If we used the JSR199Complier by default would that allow us to
remove the Eclipse compiler as a dependency?

2. Why would anyone use the JavacCompiler in preference to JSR199Complier?

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: javax.tools based JSP compiler

Posted by Rémy Maucherat <re...@apache.org>.
On Wed, May 8, 2019 at 10:31 PM Emmanuel Bourg <eb...@apache.org> wrote:

> Hi all,
>
> I've rebased the javax.tools JSP compiler on top of the current master
> branch :
>
>   https://github.com/ebourg/tomcat/tree/jasper-javax-tools-support
>
> Please let me know how you feel about this stuff and if it's worth merging.
>
> Ok, so it feels like a win over Ant, so it should be merged, but I didn't
test it.

Rémy