Re: JavaHL jar file containing class files for unit tests

Jun Omae <[email protected]> Mon, 27 Jul 2026 07:09:21 +0900
Newsgroups gmane.comp.version-control.subversion.devel
Message-ID <CAEVLMahyXvmmSA_A9ytf7UvrF7NTYCgdCq5EM=v+PT7tThM=2w@mail.gmail.com>
--000000000000341e9506578adc0b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 27, 2026 at 12:30=E2=80=AFAM Daniel Sahlberg <
[email protected]> wrote:

> Den s=C3=B6n 26 juli 2026 kl 12:06 skrev Jun Omae <[email protected]>:
>
>> On Sun, Jul 26, 2026 at 6:39=E2=80=AFPM Branko =C4=8Cibej <brane@apache.=
org> wrote:
>> >
>> > On 26. 7. 2026 11:24, Jun Omae wrote:
>> >
>> > Hi,
>> >
>> > I noticed that svn-javahl.jar file has class files for unit tests whil=
e
>> working for support build JavaHL with cmake.
>> > I don't think it's necessary for the jar file for distribution.... is
>> that intentional?
>> >
>> >
>> >
>> > I noticed this myself the last time I looked at JavaHL. I'm not sure
>> how this came about in the first place, but by now it's intentional beca=
use
>> it's always been this way. Maybe it's to allow users who only use binari=
es
>> to run JavaHL tests. In any case this is part of the published ABI.
>>
>>
>> In JavaDoc for JavaHL, test classes are not described.
>> See https://subversion.apache.org/docs/javahl/1.14/
>>
>>
>> > In JavaHL build with cmake, the class files for unit tests are archive=
d
>> into svn-javahl-tests.jar, and only svn-javahl.jar is installed.
>> >
>> >
>> > The CMake build must create a JAR that is identical to what the
>> autotools produce.
>>
>>
>> JUnit jar is not required for build with autoconf. Without JUnit jar,
>> the svn-javahl.jar doesn't have test classes.
>>
>
> How did you configure your build?
>
> If I configure with --with-junit=3D/path/to/junit-4.13.2.jar, I can run `=
make
> install-javahl` successfully.
>
> However if I configure without --with-junit (and run make clean!), I get
> error messages whenever I run `make install-javahl`:
> [[[
> /home/dsg/ramdisk/svn_trunk/subversion/bindings/javahl/tests/org/apache/s=
ubversion/javahl/BasicTests.java:1446:
> error: cannot find symbol
>         assertEquals(expected, actual);
>         ^
>   symbol:   method assertEquals(String,String)
>   location: class BasicTests
> ]]]
>
> What I'd like to confirm is if we can create a JAR without the test
> classes.
>
> @Jun Omae <[email protected]> Is there a problem if we include the test
> classes?
>
> Cheers,
> Daniel
>
>

[[[
$ svn co -q https://svn.apache.org/repos/asf/subversion/branches/1.14.x
./subversion-1.14.x
$ svn cleanup --remove-{unversioned,ignored}
$ cd ./subversion-1.14.x$ /bin/sh autogen.sh
$ ./configure --prefix=3D/dev/shm/svn-javahl --without-apxs --without-swig =
\
>   --enable-javahl --with-jdk=3D/usr/lib/jvm/java-11-openjdk-amd64 \
>   --without-junit PYTHON=3D/usr/bin/python3
$ make -j$(nproc) all
$ make javahl
$ make install
$ make install-javahl
$ unzip -l /dev/shm/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F
.class | wc -l
276
$ unzip -l /dev/shm/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F Test
| wc -l
0
]]]

> Is there a problem if we include the test classes?

No direct issues have been found so far. However, static initializers
within test classes are executed simply by loading the class.

[[[
$ grep -r 'static *{' subversion/bindings/javahl
subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.jav=
a:
   static {
subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.jav=
a:
   static {
]]]

--
Jun Omae <[email protected]> (=E5=A4=A7=E5=89=8D =E6=BD=A4)

--000000000000341e9506578adc0b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:courier new,monospace"><br></div></div><br><div class=3D"gmail_quo=
te gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Jul=
 27, 2026 at 12:30=E2=80=AFAM Daniel Sahlberg &lt;<a href=3D"mailto:daniel.=
[email protected]">[email protected]</a>&gt; wrote:<br></div><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=
=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><span style=3D"background-color:=
transparent">Den s=C3=B6n 26 juli 2026 kl 12:06 skrev Jun Omae &lt;<a href=
=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt;:<=
/span></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">On Sun, Jul 26, 2026 at 6:39=E2=80=AFPM Branko =C4=8Cibej &lt=
;<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>=
&gt; wrote:<br>
&gt;<br>
&gt; On 26. 7. 2026 11:24, Jun Omae wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I noticed that svn-javahl.jar file has class files for unit tests whil=
e working for support build JavaHL with cmake.<br>
&gt; I don&#39;t think it&#39;s necessary for the jar file for distribution=
.... is that intentional?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I noticed this myself the last time I looked at JavaHL. I&#39;m not su=
re how this came about in the first place, but by now it&#39;s intentional =
because it&#39;s always been this way. Maybe it&#39;s to allow users who on=
ly use binaries to run JavaHL tests. In any case this is part of the publis=
hed ABI.<br>
<br>
<br>
In JavaDoc for JavaHL, test classes are not described.<br>
See <a href=3D"https://subversion.apache.org/docs/javahl/1.14/" rel=3D"nore=
ferrer" target=3D"_blank">https://subversion.apache.org/docs/javahl/1.14/</=
a><br>
<br>
<br>
&gt; In JavaHL build with cmake, the class files for unit tests are archive=
d into svn-javahl-tests.jar, and only svn-javahl.jar is installed.<br>
&gt;<br>
&gt;<br>
&gt; The CMake build must create a JAR that is identical to what the autoto=
ols produce.<br>
<br>
<br>
JUnit jar is not required for build with autoconf. Without JUnit jar,<br>
the svn-javahl.jar doesn&#39;t have test classes.<br></blockquote><div><br>=
</div><div>How did you configure your build?</div><div><br></div><div><div>=
<span style=3D"background-color:transparent">I</span><span style=3D"backgro=
und-color:transparent">f I configure with --with-junit=3D/path/to/junit-4.1=
3.2.jar, I can run=C2=A0</span><span style=3D"background-color:transparent"=
>`make install-javahl`</span><span style=3D"background-color:transparent">=
=C2=A0successfully.</span></div><br></div><div>However if I configure witho=
ut --with-junit (and run make clean!), I get error messages w<span style=3D=
"background-color:transparent">henever I run `make install-javahl`:</span><=
/div><div>[[[</div>/home/dsg/ramdisk/svn_trunk/subversion/bindings/javahl/t=
ests/org/apache/subversion/javahl/BasicTests.java:1446: error: cannot find =
symbol<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 assertEquals(expected, actual);<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br>=C2=A0 symbol: =C2=A0 method assertEquals(=
String,String)<br><div><span style=3D"background-color:transparent">=C2=A0 =
location: class BasicTests</span></div><div>]]]</div><div><br></div><div>Wh=
at I&#39;d like to confirm is if we can create a JAR without the test class=
es.</div><div><br></div><div><a class=3D"gmail_plusreply" id=3D"m_198038963=
2522299721plusReplyChip-0" href=3D"mailto:[email protected]" target=3D"_bla=
nk">@Jun Omae</a><span class=3D"gmail_default" style=3D"font-family:courier=
 new,monospace"></span>=C2=A0<span class=3D"gmail_default" style=3D"font-fa=
mily:courier new,monospace"></span>Is there a problem if we include the tes=
t classes?<br></div><div><br></div><div><span style=3D"background-color:tra=
nsparent">Cheers,</span></div><div><span style=3D"background-color:transpar=
ent">Daniel</span></div><div><br></div></div></div>
</div>
</div>
</blockquote></div><div><br></div><div><br></div><div>[[[</div>$ svn co -q =
<a href=3D"https://svn.apache.org/repos/asf/subversion/branches/1.14.x">htt=
ps://svn.apache.org/repos/asf/subversion/branches/1.14.x</a> ./subversion-1=
.14.x<br>$ svn cleanup --remove-{unversioned,ignored}<br>$ cd ./subversion-=
1.14.x$ /bin/sh autogen.sh<br>$ ./configure --prefix=3D/dev/shm/svn-javahl =
--without-apxs --without-swig \<br>&gt; =C2=A0 --enable-javahl --with-jdk=
=3D/usr/lib/jvm/java-11-openjdk-amd64 \<br>&gt; =C2=A0 --without-junit PYTH=
ON=3D/usr/bin/python3<br>$ make -j$(nproc) all<br>$ make javahl<br>$ make i=
nstall<br>$ make install-javahl<br>$ unzip -l /dev/shm/svn-javahl/lib/svn-j=
avahl/svn-javahl.jar | grep -F .class | wc -l<br>276<br>$ unzip -l /dev/shm=
/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F Test | wc -l<br>0<br>]]=
]<br><br>&gt; Is there a problem if we include the test classes?<br><br><di=
v>No direct issues have been found so far. However, static initializers wit=
hin test classes are executed simply by loading the class.</div><div><br></=
div>[[[<br>$ grep -r &#39;static *{&#39; subversion/bindings/javahl<br>subv=
ersion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java: =
=C2=A0 =C2=A0static {<br>subversion/bindings/javahl/tests/org/apache/subver=
sion/javahl/UtilTests.java: =C2=A0 =C2=A0static {<br>]]]<br><div style=3D"f=
ont-family:courier new,monospace" class=3D"gmail_default"></div><br>--<br>J=
un Omae &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; =
(=E5=A4=A7=E5=89=8D =E6=BD=A4)</div>

--000000000000341e9506578adc0b--