]> gerrit.simantics Code Review - simantics/3d.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/3d/trunk@28588 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/CompoundRelatedGetSetValueRuleFactory.java
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/OptionalRelatedElementsRuleFactory.java
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/CompoundValueAccessor.java
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/FieldAccessor.java
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DefaultSchema.java
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DynamicSimpleLinkType.java
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/OptionalRelatedElementsRuleFactory.java
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectsAccessor.java
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedOrderedSetElementsAccessor.java
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralRelatedObjectsAccessor.java

index 6d625abeaff0efa3ea47dbd1ff8ebbd8f78f5696..2120b50fe8fe1f3f0831f28867db7a2d9076e93c 100644 (file)
@@ -22,11 +22,8 @@ import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;
 import org.simantics.objmap.graph.annotations.CompoundRelatedGetValue;\r
 import org.simantics.objmap.graph.annotations.CompoundRelatedSetValue;\r
 import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
 import org.simantics.objmap.graph.rules.domain.CompoundValueAccessor;\r
 import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.AdaptedRangeAccessor;\r
 import org.simantics.objmap.graph.rules.range.CompoundGetSetValueAccessor;\r
 import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
 \r
index 23ff16448df7efe5cdc78c5a4a9c4ed5cdd03258..84b1134ac01f9cec9cbdd7c65a16c47bcecb05ac 100644 (file)
@@ -37,7 +37,7 @@ public class OptionalRelatedElementsRuleFactory<Range> implements IFieldRuleFact
         return new MappedElementsRule<Resource, Range>(\r
                 new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
                         annotation.composition()),\r
-                new FieldAccessorWithDefault<Range,Collection<Range>>(field, (Collection<Range>)Collections.emptyList())\r
+                new FieldAccessorWithDefault<Range,Collection<Range>>(field, Collections.<Range>emptyList())\r
                 );\r
     }\r
 \r
index bdecbcde33c4b498204604a67e29bfa4d43ca2e0..4d29ac0a61bf234fff66895aeb8d3a466eeb8bf5 100644 (file)
@@ -68,6 +68,7 @@ public class CompoundValueAccessor implements IDomainAccessor<Resource,Object> {
                try {\r
                        Layer0 l0 = Layer0.getInstance(g);\r
                    LOGGER.info("        CompoundValueAccessor.set");\r
+                   @SuppressWarnings("unchecked")\r
                    Map<String,Object> values = (Map<String, Object>)v;\r
                    \r
                    Collection<Statement> coll = g.getStatements(element, objRelation);\r
index d4742d2f013d68f9a7fa5a92adb9422218220fd8..4cd0f2e530f1bdd4769ab73ebafd999d66e6f498 100644 (file)
@@ -34,7 +34,8 @@ public class FieldAccessor<Range,T> implements IRangeAccessor<Range,T> {
        @Override\r
        public T get(Range 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
index e07972895e5d4a4fa3ea3b91234bb2f9a1603887..e5adac845ad937c3d9bcfeb68ffaf1b19c76034d 100644 (file)
@@ -84,6 +84,8 @@ public class DefaultSchema implements IMappingSchema<Resource,Object> {
     public ILinkType<Resource,Object> linkTypeOfRangeType(Class<?> clazz) {\r
        ILinkType<Resource,Object> type = rangeLinkTypes.get(clazz);\r
        if(type == null)  {\r
+               // FIXME: c is not referenced at all, should it be?\r
+               // TODO: should this method take inheritance into account ?\r
                        for (Class<?> c : clazz.getInterfaces()) {\r
                                type = rangeLinkTypes.get(clazz);\r
                                if (type != null)\r
index 4205f2c4535fd933f89ca55ebf2b842b1d5890cf..bc436288809cfb87e51fde91337fb3ae3ebac620 100644 (file)
@@ -69,7 +69,7 @@ public class DynamicSimpleLinkType<Range> extends SimpleLinkType<Range>{
     public Resource createDomainElement(WriteGraph g, Range rangeElement)\r
             throws MappingException {\r
         try {\r
-               String typeUri = (String)typeGetter.invoke(rangeElement, null);\r
+               String typeUri = (String)typeGetter.invoke(rangeElement, (Object[]) null);\r
             if(LOGGER.isInfoEnabled())\r
                 LOGGER.info("SimpleLinkType.createDomainElement " +\r
                         rangeElement.toString()\r
index 41f6ac26ee577394ede34ec77554b8c4e836e98a..734b3cd795f89ce398cc82b318fbb3d9e811409a 100644 (file)
@@ -37,7 +37,7 @@ public class OptionalRelatedElementsRuleFactory<Range> implements IFieldRuleFact
         return new MappedElementsRule<StructuralResource, Range>(\r
                 new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
                         annotation.composition(),false),\r
-                new FieldAccessorWithDefault<Range,Collection<Range>>(field, (Collection<Range>)Collections.emptyList())\r
+                new FieldAccessorWithDefault<Range,Collection<Range>>(field, Collections.<Range>emptyList())\r
                 );\r
     }\r
 \r
index b04a40d78d3a9f34d2f67145a6e8949ae6d44882..c56ffb6d1b3fb72e4b5df9c4583e062b2d124933 100644 (file)
@@ -62,7 +62,7 @@ public class RelatedObjectsAccessor implements IDomainAccessor<StructuralResourc
                   \r
                    Resource res = getServiceResource(g, element);\r
                    if (res == null)\r
-                       return Collections.EMPTY_LIST;\r
+                       return Collections.emptyList();\r
                    Collection<Resource> coll = g.getObjects(res, relation);\r
                        List<StructuralResource> result = new ArrayList<StructuralResource>(coll.size());\r
                        for (Resource r : coll) {\r
index c1164810b4423b78096a8802c2a7834e78526fcf..c9b63e4c3e976e66a93aa5fd210de531149fbc10 100644 (file)
@@ -45,7 +45,7 @@ public class RelatedOrderedSetElementsAccessor implements IDomainAccessor<Struct
                    LOGGER.info("        RelatedOrderedSetElementsAccessor.get");\r
                    Resource res = getServiceResource(g, element);\r
                    if (res == null)\r
-                       return Collections.EMPTY_LIST;\r
+                       return Collections.emptyList();\r
                        List<Resource> list =  OrderedSetUtils.toList(g, res);\r
                        List<StructuralResource> result = new ArrayList<StructuralResource>(list.size());\r
                        for (Resource r : list) {\r
index ce1295cfe9df5e41367de0d33c0d06f332561764..c2bc6f9eebe67f19807390c42a7227519868a59b 100644 (file)
@@ -21,12 +21,10 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
 import org.simantics.objmap.exceptions.MappingException;\r
 import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
 import org.simantics.objmap.graph.rules.domain.MappingUtils;\r
 import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
 \r
 \r
 public class StructuralRelatedObjectsAccessor implements IDomainAccessor<StructuralResource,Collection<StructuralResource>> {\r
@@ -48,7 +46,7 @@ public class StructuralRelatedObjectsAccessor implements IDomainAccessor<Structu
                    LOGGER.info("        RelatedObjectsAccessor.get");\r
                        \r
                    if (!element.isStructural())\r
-                       return Collections.EMPTY_LIST;\r
+                       return Collections.emptyList();\r
                    \r
                    // Structural instance\r
                    Resource instance = StructuralUtils.getContainingInstance(element);\r
@@ -56,7 +54,7 @@ public class StructuralRelatedObjectsAccessor implements IDomainAccessor<Structu
                    Resource publicRelation = StructuralUtils.getPublishedRelation(g, element, relation);\r
                    \r
                    if (publicRelation == null)\r
-                     return Collections.EMPTY_LIST;\r
+                     return Collections.emptyList();\r
                    \r
                    Collection<Resource> coll = g.getObjects(instance, publicRelation);\r
                        List<StructuralResource> result = new ArrayList<StructuralResource>(coll.size());\r