Make SWIG generated Java interface file not visible outside package

lille stor via Swig-user <[email protected]> Thu, 20 Jun 2024 11:20:46 +0200
Newsgroups gmane.comp.programming.swig
Message-ID <trinity-aad62ca6-7cc1-48d2-9b51-128bdb3d8149-1718875246756@3c-app-mailcom-bs05>
--===============6750713600312557248==
Content-Type: text/html; charset=UTF-8

<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I am using SWIG (version 4.2.1) to generate a Java wrapper for some C code. This C code has some constants that SWIG represents with the Java interface file below. As it stands, this interface can be accessed by classes outside the &quot;abc&quot; package because it is declared as &quot;public&quot;.</div>

<div>&nbsp;</div>

<div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; /* ----------------------------------------------------------------------------<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* This file was automatically generated by SWIG (<a href="http://www.swig.org" target="_blank">http://www.swig.org</a>).<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* Version 4.2.1<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;*<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* Do not make changes to this file unless you know what you are doing--modify<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* the SWIG interface file instead.<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;* ----------------------------------------------------------------------------- */</div>

<div>&nbsp;&nbsp;&nbsp;&nbsp; package abc;</div>

<div>&nbsp;&nbsp;&nbsp;&nbsp; public interface TestConstants {<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; public final static int YES = TestJNI.YES_get();<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; public final static int NO = TestJNI.NO_get();<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; public final static int ENABLED = TestJNI.ENABLED_get();<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; public final static int DISABLED = TestJNI.DISABLED_get();<br/>
&nbsp;&nbsp;&nbsp;&nbsp; }</div>

<div>&nbsp;</div>
</div>

<div>&nbsp;</div>

<div>How can I make this interface visible only to classes within the same package (i.e., change &quot;public interface TestConstants&quot; to just &quot;interface TestConstants&quot;)? I have tried:</div>

<div>&nbsp;</div>

<div>&nbsp;&nbsp;&nbsp;&nbsp; %typemap(javainterfacemodifiers) SWIGTYPE &quot;interface&quot;</div>

<div>&nbsp;</div>

<div>... but it did not work. How can I achieve this using SWIG?</div>

<div>&nbsp;</div></div></body></html>


--===============6750713600312557248==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============6750713600312557248==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user

--===============6750713600312557248==--