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;
}
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;
}
One answer
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.
"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
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>
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 02 '15, 8:20 a.m.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).