Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RTC Identifier Types

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;
    }


0 votes

Comments

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
  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.

0 votes

Comments

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Jun 02 '15, 8:12 a.m.

Question was seen: 2,724 times

Last updated: Jun 02 '15, 8:37 a.m.

Confirmation Cancel Confirm