How to set SWIG generated java interface as not public
lille stor via Swig-user <[email protected]> Fri, 14 Jun 2024 08:14:32 +0200
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <trinity-6eaecd95-d4be-4d3e-8ff7-af08ed089109-1718345672557@3c-app-mailcom-bs06> |
--===============5182684239453412073==
Content-Type: text/html; charset=UTF-8
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><p>I am using SWIG 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 <code>abc</code> package because it is declared as <code>public</code>. How can I modify the SWIG configuration to make this interface visible only to classes within the same package (i.e., change "<code>public interface TestConstants"</code> to <code>"interface TestConstants"</code>)? I've tried several approaches (e.g., using typemaps and pragmas), but none have worked.</p>
<p>Here is the automatically generated Java interface file:</p>
<pre class="lang-java s-code-block"><code class="hljs language-java"><span class="hljs-comment"> /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */</span>
<span class="hljs-keyword"> package</span> abc;
<span class="hljs-keyword"> public</span> <span class="hljs-keyword">interface</span> <span class="hljs-title class_">TestConstants</span> {
<span class="hljs-keyword">public</span> <span class="hljs-keyword">final</span> <span class="hljs-keyword">static</span> <span class="hljs-type">int</span> <span class="hljs-variable">YES</span> <span class="hljs-operator">=</span> TestJNI.YES_get();
<span class="hljs-keyword">public</span> <span class="hljs-keyword">final</span> <span class="hljs-keyword">static</span> <span class="hljs-type">int</span> <span class="hljs-variable">NO</span> <span class="hljs-operator">=</span> TestJNI.NO_get();
<span class="hljs-keyword">public</span> <span class="hljs-keyword">final</span> <span class="hljs-keyword">static</span> <span class="hljs-type">int</span> <span class="hljs-variable">ENABLED</span> <span class="hljs-operator">=</span> TestJNI.ENABLED_get();
<span class="hljs-keyword">public</span> <span class="hljs-keyword">final</span> <span class="hljs-keyword">static</span> <span class="hljs-type">int</span> <span class="hljs-variable">DISABLED</span> <span class="hljs-operator">=</span> TestJNI.DISABLED_get();
}</code></pre>
<div> </div>
<div>
<p>How can I achieve this using SWIG? Thanks!</p>
<p>PS: I have posted this same question in stackoverflow but have received no answers until now...</p>
<p> </p>
</div></div></body></html>
--===============5182684239453412073==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============5182684239453412073==
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
--===============5182684239453412073==--