|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
SF.net SVN: stripes:[1212] branches/1.5.xRevision: 1212
http://stripes.svn.sourceforge.net/stripes/?rev=1212&view=rev Author: bengunter Date: 2009-10-27 19:49:21 +0000 (Tue, 27 Oct 2009) Log Message: ----------- Rolled up fix for STS-694 and STS-716 from trunk (fix compiler warnings). Note that minor fix slipped in here affecting STS-704. Modified Paths: -------------- branches/1.5.x/stripes/src/net/sourceforge/stripes/ajax/JavaScriptBuilder.java branches/1.5.x/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/BindingPolicyManager.java branches/1.5.x/stripes/src/net/sourceforge/stripes/format/DateFormatter.java branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputHiddenTag.java branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTagExtraInfo.java branches/1.5.x/stripes/src/net/sourceforge/stripes/util/CollectionUtil.java branches/1.5.x/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java branches/1.5.x/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java branches/1.5.x/tests/src/net/sourceforge/stripes/controller/BeforeAfterMethodInterceptorTests.java branches/1.5.x/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/ajax/JavaScriptBuilder.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/ajax/JavaScriptBuilder.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/ajax/JavaScriptBuilder.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -103,7 +103,7 @@ this.excludeProperties = new HashSet<String>(); for (Object object : objectsToExclude) { - if (object instanceof Class) + if (object instanceof Class<?>) addClassExclusion((Class<?>) object); else if (object instanceof String) addPropertyExclusion((String) object); Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -105,6 +105,7 @@ * Creates and stores instances of the objects of the type that the Configuration is * responsible for providing, except where subclasses have already provided instances. */ + @SuppressWarnings("unchecked") public void init() { try { Boolean debugMode = initDebugMode(); Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/BindingPolicyManager.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/BindingPolicyManager.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/BindingPolicyManager.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -130,7 +130,7 @@ public boolean isBindingAllowed(PropertyExpressionEvaluation eval) { // Ensure no-one is trying to bind into the ActionBeanContext!! Type firstNodeType = eval.getRootNode().getValueType(); - if (firstNodeType instanceof Class + if (firstNodeType instanceof Class<?> && ActionBeanContext.class.isAssignableFrom((Class<?>) firstNodeType)) { return false; } Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/format/DateFormatter.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/format/DateFormatter.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/format/DateFormatter.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -153,7 +153,7 @@ * should override init() and then set the date format object. */ public void setDateFormat(DateFormat dateFormat) { - this.format = format; + this.format = dateFormat; } /** Formats a Date as a String using the rules supplied when the formatter was built. */ Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputHiddenTag.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputHiddenTag.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputHiddenTag.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -108,7 +108,7 @@ writeSingletonTag(getPageContext().getOut(), "input"); } } - else if (valueOrValues instanceof Collection) { + else if (valueOrValues instanceof Collection<?>) { for (Object value : (Collection<?>) valueOrValues) { getAttributes().put("value", format(value)); writeSingletonTag(getPageContext().getOut(), "input"); Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -108,7 +108,7 @@ returnValue = Array.get(unknown, 0); } } - else if (unknown != null && unknown instanceof Collection) { + else if (unknown != null && unknown instanceof Collection<?>) { Collection<?> collection = (Collection<?>) unknown; if (collection.size() > 0) { returnValue = collection.iterator().next(); @@ -206,7 +206,7 @@ } } } - else if (selected instanceof Collection) { + else if (selected instanceof Collection<?>) { Collection<?> selectedIf = (Collection<?>) selected; for (Object item : selectedIf) { if ( (format(item, false).equals(stringValue)) ) { Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTagExtraInfo.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTagExtraInfo.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/UseActionBeanTagExtraInfo.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -49,7 +49,7 @@ if (var == null) var = tag.getAttributeString("id"); // Make sure we have the class name, not the class - if (beanclass instanceof Class) beanclass = ((Class<?>) beanclass).getName(); + if (beanclass instanceof Class<?>) beanclass = ((Class<?>) beanclass).getName(); // Return the variable info if (beanclass instanceof String) { Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/util/CollectionUtil.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/util/CollectionUtil.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/util/CollectionUtil.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -149,7 +149,7 @@ * @return either the Iterable itself if it is a List, or a new List with the same elements */ public static <T> List<T> asList(Iterable<T> in) { - if (in instanceof List) return (List<T>) in; + if (in instanceof List<?>) return (List<T>) in; else { LinkedList<T> list = new LinkedList<T>(); for (T item : in) { Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -221,7 +221,7 @@ for (Object v : values) { // Special case: recurse for nested collections and arrays! - if (v instanceof Collection) { + if (v instanceof Collection<?>) { addParameter(name, ((Collection<?>) v).toArray()); } else if (v != null && v.getClass().isArray()) { @@ -256,7 +256,7 @@ else if (valueOrValues.getClass().isArray()) { addParameter(name, CollectionUtil.asObjectArray(valueOrValues)); } - else if (valueOrValues instanceof Collection) { + else if (valueOrValues instanceof Collection<?>) { addParameter(name, (Collection<?>) valueOrValues); } else { Modified: branches/1.5.x/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java =================================================================== --- branches/1.5.x/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/stripes/src/net/sourceforge/stripes/util/bean/PropertyExpressionEvaluation.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -110,7 +110,7 @@ for (NodeEvaluation current = this.root; current != null; current = current.getNext()) { // Firstly if the current type is a wildcard type of a type variable try and // figure out what the real value to use is - while (type instanceof WildcardType || type instanceof TypeVariable) { + while (type instanceof WildcardType || type instanceof TypeVariable<?>) { if (type instanceof WildcardType) { type = getWildcardTypeBound((WildcardType) type); } @@ -127,7 +127,7 @@ current.setType(NodeType.ArrayEntry); continue; } - else if (type instanceof Class && ((Class<?>) type).isArray()) { + else if (type instanceof Class<?> && ((Class<?>) type).isArray()) { type = ((Class<?>) type).getComponentType(); current.setValueType(type); current.setKeyType(Integer.class); @@ -140,7 +140,7 @@ ParameterizedType ptype = (ParameterizedType) type; Type rawType = convertToClass(type, current); - if (rawType instanceof Class) { + if (rawType instanceof Class<?>) { Class<?> rawClass = (Class<?>) rawType; if (List.class.isAssignableFrom(rawClass)) { type = ptype.getActualTypeArguments()[0]; @@ -171,7 +171,7 @@ // Else if it's just a regular class we can try looking for a property on it. If // no property exists, just bail out and return null immediately - if (type instanceof Class) { + if (type instanceof Class<?>) { Class<?> clazz = (Class<?>) type; String property = current.getNode().getStringValue(); type = getBeanPropertyType(clazz, property); @@ -371,17 +371,17 @@ type = ((ParameterizedType) type).getRawType(); } - while (type instanceof WildcardType || type instanceof TypeVariable) { + while (type instanceof WildcardType || type instanceof TypeVariable<?>) { if (type instanceof WildcardType) { type = getWildcardTypeBound((WildcardType) type); } - else if (type instanceof TypeVariable) { + else if (type instanceof TypeVariable<?>) { type = getTypeVariableValue(evaluation, (TypeVariable<?>) type); } } // And now that we should have a single type, try and get a Class - if (type instanceof Class) { + if (type instanceof Class<?>) { return (Class<?>) type; } else { @@ -413,7 +413,7 @@ Type type = n.getValueType(); // Bean class found? Stop searching. - if (type instanceof Class) { + if (type instanceof Class<?>) { lastBean = (Class<?>) n.getValueType(); break; } @@ -426,7 +426,7 @@ // Now find the parent of the ptype and see if it's a ptype too! Type rawtype = ptype.getRawType(); - if (rawtype instanceof Class) { + if (rawtype instanceof Class<?>) { Class<?> superclass = (Class<?>) rawtype; Type supertype = superclass.getGenericSuperclass(); ptype = (supertype instanceof ParameterizedType) ? (ParameterizedType) supertype : null; @@ -453,8 +453,8 @@ // Map the type variable to a type. if ((type = typemap1.get(i).get(typeVar)) != null) { // Reached a real class? Done. - if (type instanceof Class) { return type; } - else if (type instanceof TypeVariable) { + if (type instanceof Class<?>) { return type; } + else if (type instanceof TypeVariable<?>) { typeVar = (TypeVariable<?>) type; } } @@ -467,8 +467,8 @@ // Map the type variable to a type. if ((type = typemap2.get(i).get(typeVar)) != null) { // Reached a real class? Done. - if (type instanceof Class) { return type; } - else if (type instanceof TypeVariable) { + if (type instanceof Class<?>) { return type; } + else if (type instanceof TypeVariable<?>) { typeVar = (TypeVariable<?>) type; } } @@ -488,7 +488,7 @@ */ private void addTypeMappings(List<HashMap<TypeVariable<?>, Type>> typemap, ParameterizedType paramType) { Type rawType = paramType.getRawType(); - if (rawType instanceof Class) { + if (rawType instanceof Class<?>) { Class<?> rawClass = (Class<?>) rawType; TypeVariable<?>[] vars = rawClass.getTypeParameters(); Type[] args = paramType.getActualTypeArguments(); Modified: branches/1.5.x/tests/src/net/sourceforge/stripes/controller/BeforeAfterMethodInterceptorTests.java =================================================================== --- branches/1.5.x/tests/src/net/sourceforge/stripes/controller/BeforeAfterMethodInterceptorTests.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/tests/src/net/sourceforge/stripes/controller/BeforeAfterMethodInterceptorTests.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -237,26 +237,31 @@ return null; } + @SuppressWarnings("unused") @Before(stages=LifecycleStage.ActionBeanResolution) public void beforeActionBeanResolutionWillNeverBeCalled() { hasCalledBeforeActionBeanResolutionWillNeverBeCalled++; } + @SuppressWarnings("unused") @Before public void beforeDefaultStage() { hasCalledBeforeDefaultStage++; } + @SuppressWarnings("unused") @Before(stages=LifecycleStage.HandlerResolution) public void beforeSpecificStage() { hasCalledBeforeSpecificStage++; } + @SuppressWarnings("unused") @Before(stages={LifecycleStage.BindingAndValidation, LifecycleStage.CustomValidation}) public void beforeTwoStages() { hasCalledBeforeTwoStages++; } + @SuppressWarnings("unused") @Before public String beforeWithReturn() { hasCalledBeforeWithReturn++; @@ -264,12 +269,14 @@ } /** Parameters are not allowed. */ + @SuppressWarnings("unused") @Before public void beforeWithParameter(String var) { hasCalledBeforeWithParameter++; } /** Parameters are not allowed. */ + @SuppressWarnings("unused") @Before public String beforeWithReturnAndParameter(String var) { hasCalledBeforeWithReturnAndParameter++; @@ -277,32 +284,38 @@ } /** Should work just like a public method. */ + @SuppressWarnings("unused") @Before protected void protectedBeforeMethod() { hasCalledProtectedBeforeMethod++; } /** Not annotated to be called by anyone */ + @SuppressWarnings("unused") public void dummyMethod() { hasCalledDummyMethod++; } + @SuppressWarnings("unused") @After public void afterDefaultStage() { hasCalledAfterDefaultStage++; } + @SuppressWarnings("unused") @After(stages=LifecycleStage.ActionBeanResolution) public void afterSpecificStage() { hasCalledAfterSpecificStage++; } + @SuppressWarnings("unused") @After(stages={LifecycleStage.HandlerResolution, LifecycleStage.CustomValidation}) public void afterTwoStages() { hasCalledAfterTwoStages++; } /** Returns are ok, and will just be ignored if not Resolutions. */ + @SuppressWarnings("unused") @After public String afterWithReturn() { hasCalledAfterWithReturn++; @@ -310,12 +323,14 @@ } /** Not invoked because parameters are not kosher. */ + @SuppressWarnings("unused") @After public void afterWithParameter(String var) { hasCalledAfterWithParameter++; } /** Not invoked because parameters are not kosher. */ + @SuppressWarnings("unused") @After public String afterWithReturnAndParameter(String var) { hasCalledAfterWithReturnAndParameter++; @@ -323,6 +338,7 @@ } /** Should work just like a public method. */ + @SuppressWarnings("unused") @After protected void protectedAfterMethod() { hasCalledProtectedAfterMethod++; @@ -330,6 +346,7 @@ /** Not invoked because parameters are not kosher. */ + @SuppressWarnings("unused") @Before @After public String beforeAfterWithParameter(String var) { hasCalledBeforeAfterWithParameter++; @@ -337,6 +354,7 @@ } /** Invoked only at those stages listed. */ + @SuppressWarnings("unused") @Before(stages=LifecycleStage.BindingAndValidation) @After(stages=LifecycleStage.CustomValidation) public void beforeAfterSpecificStage() { @@ -344,12 +362,14 @@ } /** Invoked only at default EventHandling stage. */ + @SuppressWarnings("unused") @Before @After public void beforeAfterDefaultStage() { hasCalledBeforeAfterDefaultStage++; } /** Invoked only at default EventHandling stage. */ + @SuppressWarnings("unused") @Before(on="edit") @After(on="save") public void beforeAfterOnSingleEvent() { hasCalledBeforeAfterOnSingleEvent++; @@ -367,6 +387,7 @@ public int getHasCalledBeforeTwoStages() { return hasCalledBeforeTwoStages; } public int getHasCalledBeforeAfterSpecificStage() { return hasCalledBeforeAfterSpecificStage; } public int getHasCalledBeforeAfterWithParameter() { return hasCalledBeforeAfterWithParameter; } + @SuppressWarnings("unused") public int getHasCalledBeforeActionBeanResolutionWillNeverBeCalled() { return hasCalledBeforeActionBeanResolutionWillNeverBeCalled; } public int getHasCalledBeforeWithReturn() { return hasCalledBeforeWithReturn; } public int getHasCalledBeforeWithParameter() { return hasCalledBeforeWithParameter; } Modified: branches/1.5.x/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java =================================================================== --- branches/1.5.x/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java 2009-10-27 19:34:14 UTC (rev 1211) +++ branches/1.5.x/tests/src/net/sourceforge/stripes/integration/spring/SpringHelperTests.java 2009-10-27 19:49:21 UTC (rev 1212) @@ -29,6 +29,7 @@ private static class ExplicitPublicSetterTarget { private TestBean bean; + @SuppressWarnings("unused") @SpringBean("test/TestBean") public void setBean(TestBean bean) { this.bean = bean; } public TestBean getBean() { return bean; } @@ -76,6 +77,7 @@ private static class ExplicitNonStandardSetterTarget { private TestBean bean; + @SuppressWarnings("unused") @SpringBean("test/TestBean") protected void injectHere(TestBean bean) { this.bean = bean; } TestBean getBean() { return bean; } @@ -92,6 +94,7 @@ private static class ImplicitNonStandardSetterTarget { private TestActionBean bean; + @SuppressWarnings("unused") @SpringBean protected void testActionBean(TestActionBean bean) { this.bean = bean; } TestActionBean getBean() { return bean; } } @@ -107,6 +110,7 @@ private static class ImplicitStandardSetterTarget { private TestActionBean bean; + @SuppressWarnings("unused") @SpringBean protected void setTestActionBean(TestActionBean bean) { this.bean = bean; } TestActionBean getBean() { return bean; } } @@ -170,6 +174,7 @@ @SpringBean("test/testActionBean") private void setNumber3(TestActionBean value) { this.number3 = value; } + @SuppressWarnings("unused") @SpringBean("testActionBean") public void whee(TestActionBean value) { this.number4 = value; } } @@ -187,6 +192,7 @@ /////////////////////////////////////////////////////////////////////////// private static class AmbiguousByTypeTarget { + @SuppressWarnings("unused") @SpringBean TestActionBean someBeanOrOther; } @@ -199,6 +205,7 @@ /////////////////////////////////////////////////////////////////////////// private static class ExplicitMisNamedTarget { + @SuppressWarnings("unused") @SpringBean("nonExistentBean") TestActionBean someBeanOrOther; } @@ -211,6 +218,7 @@ /////////////////////////////////////////////////////////////////////////// private static class ImplicitMisNamedTarget { + @SuppressWarnings("unused") @SpringBean TestActionBean tstActionBea; } @@ -223,6 +231,7 @@ /////////////////////////////////////////////////////////////////////////// private static class NoBeanOfTypeTarget { + @SuppressWarnings("unused") @SpringBean SpringHelperTests noBeansOfType; } @@ -235,7 +244,9 @@ /////////////////////////////////////////////////////////////////////////// private static class InvalidSetterSignatureTarget { + @SuppressWarnings("unused") TestActionBean testActionBean; + @SuppressWarnings("unused") @SpringBean public void setTestActionBean(TestActionBean bean, TestActionBean other) { this.testActionBean = bean; @@ -260,6 +271,7 @@ @SpringBean("test/testActionBean") private void setNumber3(TestActionBean value) { this.number3 = value; } + @SuppressWarnings("unused") @SpringBean("testActionBean") public void whee(TestActionBean value) { this.number4 = value; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Stripes-development mailing list Stripes-development@... https://lists.sourceforge.net/lists/listinfo/stripes-development |
| Free embeddable forum powered by Nabble | Forum Help |