Home Bug Reports

Lots of unneeded @Suppresswarnings("unchecked") in slice2java-generated code

mefostermefoster Member Mary Ellen FosterOrganization: Heriot-Watt University, EdinburghProject: ECHOES learning environment ✭✭✭
I'm using Ice 3.3.0 (+ patches) on Fedora 10. My Java compiler is giving me a *lot* of warnings about unnecessary @Suppresswarnings("unchecked") in the code generated by slice2java. Yes, these are just warnings (about suppressed warnings ... and I could suppress them too ... hee!), but they tend to flood my compiler output and make it hard to see other warnings.

Here's an example of what I'm talking about. Here's my .ice file:
#include <jast/common/Timestamp.ice>

module jast {
    module listener {
        interface RobotHeadListener {
            void robotGaze (double x, double y, ::jast::common::Timestamp time);
            void speechBookmark (string label, ::jast::common::Timestamp time);
        };
    };
};

Here's part of what gets generated (the same thing happens with the speechBookmark method):
@SuppressWarnings("unchecked")
    private void
    robotGaze(double x, double y, jast.common.Timestamp time, java.util.Map<String, String> __ctx, boolean __explicitCtx)
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __delBase = __getDelegate(false);
                _RobotHeadListenerDel __del = (_RobotHeadListenerDel)__delBase;
                __del.robotGaze(x, y, time, __ctx);
                return;
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __handleExceptionWrapper(__delBase, __ex, null);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, null, __cnt);
            }
        }
    }

That @Suppresswarnings call isn't actually necessary with the method body that's generated -- is it ever needed?

MEF
Sign In or Register to comment.