It's all about the answers!

Ask a question

RTC Identifier Types


harshal Wable (17315) | asked Jun 02 '15, 8:12 a.m.
My method is returning a value of type Identifier . However it is giving me warning

Any idea on how i can remove these warning . and what different types i can provide here .

Here is my code snippet
private Identifier getIdentifierAttributeValue(IWorkItem workItem, IAttribute attribute,
            IProgressMonitor monitor) throws TeamRepositoryException {
        Identifier tempDuration = null;       
         if (attribute != null && workItem.hasAttribute(attribute)) {
           
            System.out.println("UpdateParentAttributes.getAttributeValue()");
            tempDuration =  (Identifier) workItem.getValue(attribute);
            System.out.println("UpdateParentAttributes.getAttributeValue()"+tempDuration);
            if (tempDuration != null){
                System.out.println("UpdateParentAttributes.getAttributeValue()>>"+tempDuration);
                return tempDuration;
        }

         }    
        return tempDuration;
    }



Comments
Ralph Schoon commented Jun 02 '15, 8:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Would have been a good idea to provide the warning text here and also tell the readers what type the attribute is.
Here some things you should read: https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/
https://rsjazz.wordpress.com/2012/08/20/manipulationg-work-item-enumeration-values/
https://rsjazz.wordpress.com/2015/02/27/a-rtc-workitem-command-line-version-2-2/ (for all the code to access and write work item attribute types).

One answer



permanent link
harshal Wable (17315) | answered Jun 02 '15, 8:30 a.m.
  Here is my warning text

"Type Identifier is a raw type. References to generic type Identifier<T> should be parameterized"

I am trying to get a child WI Enum literal which I need to copi -as-is in the parent WI.

Comments
Ralph Schoon commented Jun 02 '15, 8:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The warning tells you that the type is not specified in a way that it is type safe.
If you check when casting, you can ignore it.
To get rid of the warning, hover over the warning and allow to add an ignore to the method. Or change the type to the type that is specified as return type - if it actually is.

Identifiers are usually returned as Identifier<? extends ILiteral>

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.