Re: Make SWIG generated Java interface file not visible outside package
lille stor via Swig-user <[email protected]> Tue, 25 Jun 2024 08:12:21 +0200
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <trinity-da2106e8-a2e1-48c0-bf0c-8b751df09306-1719295941149@3c-app-mailcom-bs03> |
--===============2500312412211193648==
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html><head></head><body><div style=3D"font-family: Verdana;font-size: 12=
=2E0px;"><div>Hi William,<br/>
<br/>
Thanks for the info!<br/>
<br/>
I'm a bit confused now=2E=2E=2E I though that the sole purpose of type=
map "javainterfacemodifiers" was to actually change, e=2Eg=2E, th=
e visibility of the generated Java interface class=2E See this commit: <a h=
ref=3D"https://deref-gmx=2Ecom/mail/client/NJMEeIruE9s/dereferrer/?redirect=
Url=3Dhttps%3A%2F%2Fderef-gmx=2Ecom%2Fmail%2Fclient%2FgVi7LFeAy8M%2Fderefer=
rer%2F%3FredirectUrl%3Dhttps%253A%252F%252Fgithub=2Ecom%252Fswig%252Fswig%2=
52Fcommit%252Fc1b004f4fa62b1b15e047fd9462ddf3b46e55357" target=3D"_blank">h=
ttps://github=2Ecom/swig/swig/commit/c1b004f4fa62b1b15e047fd9462ddf3b46e553=
57</a>=2E Also, when looking at this line <a href=3D"https://deref-gmx=2Eco=
m/mail/client/jzT5bUsR9CM/dereferrer/?redirectUrl=3Dhttps%3A%2F%2Fderef-gmx=
=2Ecom%2Fmail%2Fclient%2F8i3vhEUjpo0%2Fdereferrer%2F%3FredirectUrl%3Dhttps%=
253A%252F%252Fgithub=2Ecom%252Fswig%252Fswig%252Fblob%252Fce2bb71a486bd575a=
fb3c19ef98aae5f5e147905%252FSource%252FModules%252Fjava=2Ecxx%2523L2098" ta=
rget=3D"_blank">https://github=2Ecom/swig/swig/blob/ce2bb71a486bd575afb3c19=
ef98aae5f5e147905/Source/Modules/java=2Ecxx#L2098 </a>(in java=2Ecxx), it s=
eems to indicate that=2E<br/>
<br/>
Not sure how to proceed from here=2E=2E=2E thanks for the clarification!</=
div>
<div>
<div>
<div> </div>
<div> </div>
<div name=3D"quote" style=3D"margin:10px 5px 5px 10px; padding: 10px 0 10p=
x 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;">
<div style=3D"margin:0 0 10px 0;"><b>Sent:</b> Friday, June 21, 2024 =
at 4:05 PM<br/>
<b>From:</b> "William S Fulton" <wsf@fultondesigns=2Eco=
=2Euk><br/>
<b>To:</b> "lille stor" <lille=2Estor@gmx=2Ecom><br/>
<b>Cc:</b> swig-user@lists=2Esourceforge=2Enet<br/>
<b>Subject:</b> Re: [Swig-user] Make SWIG generated Java interface fi=
le not visible outside package</div>
<div name=3D"quoted-content">
<div>
<div> </div>
<div>This is not possible as it is hard coded to 'public'=2E We co=
uld add in some pragmas similar to the Java module class pragmas <a href=3D=
"https://swig=2Eorg/Doc4=2E2/Java=2Ehtml#Java_module_class_pragmas" target=
=3D"_blank">https://swig=2Eorg/Doc4=2E2/Java=2Ehtml#Java_module_class_pragm=
as</a> to provide this flexibility=2E I suggest adding in a Github issue fo=
r this=2E</div>
<div> </div>
<div>William</div>
</div>
<div class=3D"gmail_quote">
<div class=3D"gmail_attr">On Thu, 20 Jun 2024 at 10:21, lille stor via Swi=
g-user <<a href=3D"mailto:swig-user@lists=2Esourceforge=2Enet" onclick=
=3D"" target=3D"_blank">swig-user@lists=2Esourceforge=2Enet</a>> wrote:<=
/div>
<blockquote class=3D"gmail_quote" style=3D"margin: 0=2E0px 0=2E0px 0=2E0px=
0=2E8ex;border-left: 1=2E0px solid rgb(204,204,204);padding-left: 1=2E0ex;=
">
<div>
<div style=3D"font-family: Verdana;font-size: 12=2E0px;">
<div>I am using SWIG (version 4=2E2=2E1) to generate a Java wrapper for so=
me C code=2E This C code has some constants that SWIG represents with the J=
ava interface file below=2E As it stands, this interface can be accessed by=
classes outside the "abc" package because it is declared as &quo=
t;public"=2E</div>
<div> </div>
<div>
<div> /* -----------------------------------------=
-----------------------------------<br/>
* This file was automatically generated by =
SWIG (<a href=3D"http://www=2Eswig=2Eorg" target=3D"_blank">http://www=2Esw=
ig=2Eorg</a>)=2E<br/>
* Version 4=2E2=2E1<br/>
*<br/>
* Do not make changes to this file unless y=
ou know what you are doing--modify<br/>
* the SWIG interface file instead=2E<br/>
* -----------------------------------------=
------------------------------------ */</div>
<div> package abc;</div>
<div> public interface TestConstants {<br/>
public final stat=
ic int YES =3D TestJNI=2EYES_get();<br/>
public final stat=
ic int NO =3D TestJNI=2ENO_get();<br/>
public final stat=
ic int ENABLED =3D TestJNI=2EENABLED_get();<br/>
public final stat=
ic int DISABLED =3D TestJNI=2EDISABLED_get();<br/>
}</div>
<div> </div>
</div>
<div> </div>
<div>How can I make this interface visible only to classes within the same=
package (i=2Ee=2E, change "public interface TestConstants" to ju=
st "interface TestConstants")? I have tried:</div>
<div> </div>
<div> %typemap(javainterfacemodifiers) SWIGTYPE &q=
uot;interface"</div>
<div> </div>
<div>=2E=2E=2E but it did not work=2E How can I achieve this using SWIG?</=
div>
<div> </div>
</div>
</div>
_______________________________________________<br/>
Swig-user mailing list<br/>
<a href=3D"mailto:Swig-user@lists=2Esourceforge=2Enet" onclick=3D"" target=
=3D"_blank">Swig-user@lists=2Esourceforge=2Enet</a><br/>
<a href=3D"https://lists=2Esourceforge=2Enet/lists/listinfo/swig-user" tar=
get=3D"_blank">https://lists=2Esourceforge=2Enet/lists/listinfo/swig-user</=
a></blockquote>
</div>
</div>
</div>
</div>
</div></div></body></html>
--===============2500312412211193648==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============2500312412211193648==
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
--===============2500312412211193648==--