]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixed/ignored unnecessary warnings.
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 3 Jan 2014 09:03:11 +0000 (09:03 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 3 Jan 2014 09:03:11 +0000 (09:03 +0000)
refs #3552

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28588 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.objmap/src/org/simantics/objmap/annotations/factories/OptionalRelatedElementsRuleFactory.java
org.simantics.objmap/src/org/simantics/objmap/rules/range/FieldAccessor.java

index 20692388fd9dd693c4ff6677fc7e9e51b3aa0a60..e1974fec4a9f10c6e6180fd60713a39c10b4f501 100644 (file)
@@ -13,6 +13,7 @@ package org.simantics.objmap.annotations.factories;
 \r
 import java.lang.annotation.Annotation;\r
 import java.lang.reflect.Field;\r
+import java.util.Collection;\r
 import java.util.Collections;\r
 \r
 import org.simantics.db.ReadGraph;\r
@@ -34,7 +35,7 @@ public class OptionalRelatedElementsRuleFactory implements IFieldRuleFactory {
         return new MappedElementsRule(\r
                 new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
                         annotation.composition()),\r
-                new FieldAccessorWithDefault(field, Collections.emptyList())\r
+                new FieldAccessorWithDefault<Collection<Object>>(field, Collections.emptyList())\r
                 );\r
     }\r
 \r
index 53d0d875115de9eae4f9aadc7535b4270245b1e0..e731e3e9197f28ff28f36ac87969db056a0d53e1 100644 (file)
@@ -33,7 +33,8 @@ public class FieldAccessor<T> implements IRangeAccessor<T> {
        @Override\r
        public T get(Object element) throws MappingException {\r
                try {\r
-                   T result = (T)field.get(element);\r
+                   @SuppressWarnings("unchecked")\r
+                       T result = (T)field.get(element);\r
                    \r
                if(LOGGER.isInfoEnabled())\r
                    LOGGER.info("        FieldAccessor.get " +\r