From 3197fd8536b66064774b80eab419942f18b61a2a Mon Sep 17 00:00:00 2001 From: Simon Barner <barner@fortiss.org> Date: Thu, 10 Mar 2016 13:38:42 +0000 Subject: [PATCH] - Document get(0) --- .../view/generic/CreateAnnotationInstanceColumn.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/view/generic/CreateAnnotationInstanceColumn.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/view/generic/CreateAnnotationInstanceColumn.java index 54785af81..91d33527d 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/view/generic/CreateAnnotationInstanceColumn.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/view/generic/CreateAnnotationInstanceColumn.java @@ -64,7 +64,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService; * @author diewald, barner * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: C2AA23B5E35EDC19786775640DD3F6CE + * @ConQAT.Rating GREEN Hash: A24FA05DE5A868FBA7F8EE21F78CDDD0 */ public class CreateAnnotationInstanceColumn extends ViewerColumn { @@ -237,11 +237,15 @@ public class CreateAnnotationInstanceColumn extends ViewerColumn { // editable String value = ""; if(!columnSpec.eClass().getEStructuralFeatures().isEmpty()) { + // get(0) is safe because list is guaranteed to be non-empty. + // Furthermore, the first element is the one to use, since... EStructuralFeature dynamicInstanceFeature = columnSpec.eClass().getEStructuralFeatures().get(0); - // Annotations that can be dynamically instantiated are - // implemented using an appropriate EMap. + // ...annotations that can be dynamically instantiated are + // implemented using an appropriate EMap (which by convention + // has to be the // first (and only)) feature of the + // corresponding annotation class. if(dynamicInstanceFeature.getEType().getInstanceTypeName() .equals("java.util.Map$Entry")) { -- GitLab