This project has moved and is read-only. For the latest updates, please go here.


Class level dependencies?


It would be nice to whitelist specific classes from third-party libraries with monolithic namespaces.

The Unity game engine has every class in the UnityEngine namespace. In general I don't want the game logic layer to depend on Unity, but I'd like to make an exception for Vector and math classes.

Maybe a "ToClass" property?
    <Allowed From="GameLogic" ToClass="UnityEngine.Vector2" />
    <Allowed From="GameLogic" ToClass="UnityEngine.Vector3" />
    Don't want the whole enchilada
    <Allowed From="GameLogic" To="UnityEngine" />
Here's how Checkstyle handles it for reference purposes:
<allow class="" local-only="true"/>
<allow class="" local-only="true"/>
<allow pkg="" local-only="true"/>
<allow pkg="org.apache.commons.cli" local-only="true"/>
Closed Jan 19, 2017 at 10:05 AM by vizu


vizu wrote Feb 9, 2016 at 8:25 PM

I see your point.
I'll look into the implementation impact as soon as I'll have some time.

vizu wrote Jun 10, 2016 at 1:51 PM

New feature added in v1.5: you can define that only a part of a namespace is visible to other namespaces. Hope this resolves your scenario.

Use a config similar to this:
    <Allowed From="GameLogic" To="UnityEngine" />
    <VisibleMembers OfNamespace="UnityEngine">
        <Type Name="Vector2" />
        <Type Name="Vector3" />

wrote Jan 19, 2017 at 10:05 AM