Author: jleroux
Date: Thu Nov 5 17:30:46 2009 New Revision: 833092 URL: http://svn.apache.org/viewvc?rev=833092&view=rev Log: A patch from Marc Morin "Resolve java warnings exposed in Eclipse : framework - minilang" (https://issues.apache.org/jira/browse/OFBIZ-3115) - OFBIZ-3115 Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java Thu Nov 5 17:30:46 2009 @@ -849,7 +849,7 @@ String nodeName = curOperElem.getNodeName(); MethodOperation methodOp = null; - MethodOperation.Factory factory = methodOperationFactories.get(nodeName); + MethodOperation.Factory<MethodOperation> factory = methodOperationFactories.get(nodeName); if (factory != null) { methodOp = factory.createMethodOperation(curOperElem, simpleMethod); } else if ("else".equals(nodeName)) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethodBsfEngine.java Thu Nov 5 17:30:46 2009 @@ -45,6 +45,7 @@ protected Map<String, Object> context = FastMap.newInstance(); + @SuppressWarnings("unchecked") @Override public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); @@ -78,6 +79,7 @@ * It exectutes the funcBody text in an "anonymous" method call with * arguments. */ + @SuppressWarnings("unchecked") @Override public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector namesVec, Vector argsVec) throws BSFException { //if (namesVec.size() != argsVec.size()) throw new BSFException("number of params/names mismatch"); @@ -139,8 +141,4 @@ @Override public void terminate() { } - - private String sourceInfo(String source, int lineNo, int columnNo) { - return "SimpleMethod: " + source + " at line: " + lineNo +" column: " + columnNo; - } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleServiceEngine.java Thu Nov 5 17:30:46 2009 @@ -41,7 +41,7 @@ */ @Override public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException { - Map<String, Object> result = runSync(localName, modelService, context); + runSync(localName, modelService, context); } /** Run the service synchronously and return the result Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallObjectMethod.java Thu Nov 5 17:30:46 2009 @@ -72,7 +72,7 @@ parameters = FastList.newInstance(); for (Element parameterElement: parameterElements) { - MethodObject methodObject = null; + MethodObject<?> methodObject = null; if ("string".equals(parameterElement.getNodeName())) { methodObject = new StringObject(parameterElement, simpleMethod); } else if ("field".equals(parameterElement.getNodeName())) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java Thu Nov 5 17:30:46 2009 @@ -65,7 +65,7 @@ if (parameterElements.size() > 0) { parameters = FastList.newInstance(); for (Element parameterElement: parameterElements) { - MethodObject methodObject = null; + MethodObject<?> methodObject = null; if ("string".equals(parameterElement.getNodeName())) { methodObject = new StringObject(parameterElement, simpleMethod); } else if ("field".equals(parameterElement.getNodeName())) { @@ -103,7 +103,7 @@ parameterTypes = new Class<?>[parameters.size()]; int i = 0; - for (MethodObject methodObjectDef: parameters) { + for (MethodObject<?> methodObjectDef: parameters) { args[i] = methodObjectDef.getObject(methodContext); Class<?> typeClass = methodObjectDef.getTypeClass(methodContext.getLoader()); @@ -120,7 +120,7 @@ } try { - Constructor constructor = methodClass.getConstructor(parameterTypes); + Constructor<?> constructor = methodClass.getConstructor(parameterTypes); try { Object newObject = constructor.newInstance(args); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java Thu Nov 5 17:30:46 2009 @@ -18,8 +18,6 @@ *******************************************************************************/ package org.ofbiz.minilang.method.callops; -import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java Thu Nov 5 17:30:46 2009 @@ -18,7 +18,6 @@ *******************************************************************************/ package org.ofbiz.minilang.method.conditional; -import java.util.Iterator; import java.util.List; import javolution.util.FastList; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java Thu Nov 5 17:30:46 2009 @@ -33,12 +33,12 @@ * Creates Conditional objects according to the element that is passed. */ public abstract class ConditionalFactory<C extends Conditional> { - private static final Map<String, ConditionalFactory> conditionalFactories; + private static final Map<String, ConditionalFactory<?>> conditionalFactories; static { - Map<String, ConditionalFactory> factories = new HashMap<String, ConditionalFactory>(); - Iterator<ConditionalFactory> it = ServiceRegistry.lookupProviders(ConditionalFactory.class, ConditionalFactory.class.getClassLoader()); + Map<String, ConditionalFactory<?>> factories = new HashMap<String, ConditionalFactory<?>>(); + Iterator<ConditionalFactory<?>> it = UtilGenerics.cast(ServiceRegistry.lookupProviders(ConditionalFactory.class, ConditionalFactory.class.getClassLoader())); while (it.hasNext()) { - ConditionalFactory factory = it.next(); + ConditionalFactory<?> factory = it.next(); factories.put(factory.getName(), factory); } conditionalFactories = Collections.unmodifiableMap(factories); @@ -49,7 +49,7 @@ public static Conditional makeConditional(Element element, SimpleMethod simpleMethod) { String tagName = element.getTagName(); - ConditionalFactory factory = conditionalFactories.get(tagName); + ConditionalFactory<?> factory = conditionalFactories.get(tagName); if (factory != null) { return factory.createCondition(element, simpleMethod); } else { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java Thu Nov 5 17:30:46 2009 @@ -75,13 +75,13 @@ runSubOps = true; } } else if (fieldVal instanceof Collection) { - Collection fieldCol = (Collection) fieldVal; + Collection<?> fieldCol = (Collection<?>) fieldVal; if (fieldCol.size() == 0) { runSubOps = true; } } else if (fieldVal instanceof Map) { - Map fieldMap = (Map) fieldVal; + Map<?,?> fieldMap = (Map<?,?>) fieldVal; if (fieldMap.size() == 0) { runSubOps = true; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java Thu Nov 5 17:30:46 2009 @@ -18,7 +18,6 @@ *******************************************************************************/ package org.ofbiz.minilang.method.conditional; -import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -63,8 +62,8 @@ static PatternMatcher matcher = new Perl5Matcher(); static PatternCompiler compiler = new Perl5Compiler(); - List subOps = FastList.newInstance(); - List elseSubOps = null; + List<?> subOps = FastList.newInstance(); + List<?> elseSubOps = null; ContextAccessor<Map<String, ? extends Object>> mapAcsr; ContextAccessor<Object> fieldAcsr; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java Thu Nov 5 17:30:46 2009 @@ -128,7 +128,7 @@ } else { reader = new EntitySaxReader(delegator); } - long rowsChanged = reader.parse(dataUrl); + reader.parse(dataUrl); } catch (Exception e) { String xmlError = "Error loading XML Resource \"" + dataUrl.toExternalForm() + "\"; Error was: " + e.getMessage(); messages.add(xmlError); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java Thu Nov 5 17:30:46 2009 @@ -25,10 +25,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; -import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; -import org.ofbiz.entity.condition.EntityFieldMap; -import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; import org.ofbiz.minilang.method.MethodContext; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java Thu Nov 5 17:30:46 2009 @@ -19,7 +19,6 @@ package org.ofbiz.minilang.method.entityops; import java.util.Collection; -import java.util.List; import java.util.Map; import org.ofbiz.base.util.Debug; @@ -28,8 +27,8 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntity; -import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; import org.ofbiz.minilang.method.MethodContext; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java Thu Nov 5 17:30:46 2009 @@ -18,17 +18,16 @@ *******************************************************************************/ package org.ofbiz.minilang.method.envops; -import java.util.Iterator; import java.util.List; import java.util.Map; import javolution.util.FastList; +import org.ofbiz.base.util.Debug; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; import org.ofbiz.minilang.method.MethodContext; import org.ofbiz.minilang.method.MethodOperation; -import org.ofbiz.base.util.Debug; import org.w3c.dom.Element; /** Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java Thu Nov 5 17:30:46 2009 @@ -18,9 +18,6 @@ *******************************************************************************/ package org.ofbiz.minilang.method.envops; -import java.util.Locale; -import java.util.TimeZone; - import javolution.util.FastList; import javolution.util.FastMap; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java Thu Nov 5 17:30:46 2009 @@ -18,16 +18,21 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; -import java.util.*; -import java.lang.reflect.*; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; import javolution.util.FastList; -import org.w3c.dom.*; -import org.ofbiz.base.util.*; -import org.ofbiz.minilang.*; -import org.ofbiz.minilang.method.*; -import org.ofbiz.minilang.method.conditional.ElseIf; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.ObjectType; +import org.ofbiz.base.util.UtilXml; +import org.ofbiz.minilang.SimpleMethod; +import org.ofbiz.minilang.method.ContextAccessor; +import org.ofbiz.minilang.method.MethodContext; +import org.ofbiz.minilang.method.MethodOperation; +import org.w3c.dom.Element; /** * Iff the validate method returns true with the specified field process sub-operations Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java Thu Nov 5 17:30:46 2009 @@ -20,8 +20,6 @@ import java.math.BigDecimal; import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java?rev=833092&r1=833091&r2=833092&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java Thu Nov 5 17:30:46 2009 @@ -40,7 +40,7 @@ } @Override - public String exec(Map inMap, List messages, Locale locale, ClassLoader loader) { + public String exec(Map<String, Object> inMap, List<Object> messages, Locale locale, ClassLoader loader) { String propStr = UtilProperties.getPropertyValue(UtilURL.fromResource(resource, loader), property); if (propStr == null || propStr.length() == 0) { |
Free forum by Nabble | Edit this page |