freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker git commit: Removed now unnecessary casts
Date Fri, 17 Feb 2017 16:54:40 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 4b680d205 -> 18843c030


Removed now unnecessary casts


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/18843c03
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/18843c03
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/18843c03

Branch: refs/heads/3
Commit: 18843c030e874d73b0af68b1a7fbfe1a96f36a6b
Parents: 4b680d2
Author: ddekany <ddekany@apache.org>
Authored: Fri Feb 17 17:54:37 2017 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Fri Feb 17 17:54:37 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/freemarker/core/Template.java   |  2 +-
 .../apache/freemarker/core/TemplateException.java   |  8 ++++----
 .../freemarker/core/ast/AddConcatExpression.java    |  4 ++--
 .../freemarker/core/ast/ArithmeticEngine.java       | 16 ++++++++--------
 .../freemarker/core/ast/BuiltInsForNumbers.java     |  4 ++--
 .../apache/freemarker/core/ast/Configurable.java    |  4 ++--
 .../java/org/apache/freemarker/core/ast/Dot.java    |  2 +-
 .../org/apache/freemarker/core/ast/EvalUtil.java    |  4 ++--
 .../org/apache/freemarker/core/ast/MessageUtil.java |  8 ++++----
 .../apache/freemarker/core/ast/ParseException.java  |  2 +-
 .../java/org/apache/freemarker/core/ast/Range.java  |  4 ++--
 .../core/ast/UnexpectedTypeException.java           |  2 +-
 .../freemarker/core/debug/impl/DebuggerService.java |  4 ++--
 .../core/model/TemplateModelException.java          |  6 +++---
 .../model/impl/DefaultNonListCollectionAdapter.java |  2 +-
 .../core/model/impl/DefaultObjectWrapper.java       | 12 ++++++------
 .../core/model/impl/beans/ModelCache.java           |  2 +-
 .../core/model/impl/beans/OverloadedMethods.java    |  4 ++--
 .../core/model/impl/beans/_MethodUtil.java          |  2 +-
 .../core/model/impl/dom/NodeListModel.java          |  2 +-
 .../org/apache/freemarker/servlet/IncludePage.java  |  2 +-
 .../freemarker/servlet/jsp/JspTagModelBase.java     |  2 +-
 .../freemarker/servlet/jsp/TaglibFactory.java       |  8 ++++----
 .../ast/PrintfGTemplateNumberFormatFactory.java     |  2 +-
 24 files changed, 54 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/Template.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/Template.java b/src/main/java/org/apache/freemarker/core/Template.java
index 3ed02d0..77b18f3 100644
--- a/src/main/java/org/apache/freemarker/core/Template.java
+++ b/src/main/java/org/apache/freemarker/core/Template.java
@@ -317,7 +317,7 @@ public class Template extends Configurable {
      */
     @Deprecated
     public Template(String name, Reader reader) throws IOException {
-        this(name, reader, (Configuration) null);
+        this(name, reader, null);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/TemplateException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/TemplateException.java b/src/main/java/org/apache/freemarker/core/TemplateException.java
index ddd8f62..ef50f23 100644
--- a/src/main/java/org/apache/freemarker/core/TemplateException.java
+++ b/src/main/java/org/apache/freemarker/core/TemplateException.java
@@ -77,7 +77,7 @@ public class TemplateException extends Exception {
      * or underlying cause.
      */
     public TemplateException(Environment env) {
-        this((String) null, null, env);
+        this(null, null, env);
     }
 
     /**
@@ -95,7 +95,7 @@ public class TemplateException extends Exception {
      * backward-compatibility.
      */
     public TemplateException(Exception cause, Environment env) {
-        this((String) null, cause, env);
+        this(null, cause, env);
     }
 
     /**
@@ -108,7 +108,7 @@ public class TemplateException extends Exception {
      * @since 2.3.20
      */
     public TemplateException(Throwable cause, Environment env) {
-        this((String) null, cause, env);
+        this(null, cause, env);
     }
     
     /**
@@ -195,7 +195,7 @@ public class TemplateException extends Exception {
             if (!positionsCalculated) {
                 // The expressions is the argument of the template element, so we prefer
it as it's more specific. 
                 TemplateObject templateObject = blamedExpression != null
-                        ? (TemplateObject) blamedExpression
+                        ? blamedExpression
                         : (
                                 ftlInstructionStackSnapshot != null && ftlInstructionStackSnapshot.length
!= 0
                                 ? ftlInstructionStackSnapshot[0] : null);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/AddConcatExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/AddConcatExpression.java b/src/main/java/org/apache/freemarker/core/ast/AddConcatExpression.java
index 9e79643..813277d 100644
--- a/src/main/java/org/apache/freemarker/core/ast/AddConcatExpression.java
+++ b/src/main/java/org/apache/freemarker/core/ast/AddConcatExpression.java
@@ -81,7 +81,7 @@ final class AddConcatExpression extends Expression {
                 // we return null and do hash addition instead. (We can't simply give hash
addition a priority, like
                 // with sequence addition above, as FTL strings are often also FTL hashes.)
                 Object leftOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
-                        leftModel, leftExp, /* returnNullOnNonCoercableType = */ hashConcatPossible,
(String) null,
+                        leftModel, leftExp, /* returnNullOnNonCoercableType = */ hashConcatPossible,
null,
                         env);
                 if (leftOMOrStr == null) {
                     return _eval_concatenateHashes(leftModel, rightModel);
@@ -89,7 +89,7 @@ final class AddConcatExpression extends Expression {
 
                 // Same trick with null return as above.
                 Object rightOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
-                        rightModel, rightExp, /* returnNullOnNonCoercableType = */ hashConcatPossible,
(String) null,
+                        rightModel, rightExp, /* returnNullOnNonCoercableType = */ hashConcatPossible,
null,
                         env);
                 if (rightOMOrStr == null) {
                     return _eval_concatenateHashes(leftModel, rightModel);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/ArithmeticEngine.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/ArithmeticEngine.java b/src/main/java/org/apache/freemarker/core/ast/ArithmeticEngine.java
index b0fb358..6b2d299 100644
--- a/src/main/java/org/apache/freemarker/core/ast/ArithmeticEngine.java
+++ b/src/main/java/org/apache/freemarker/core/ast/ArithmeticEngine.java
@@ -301,8 +301,8 @@ public abstract class ArithmeticEngine {
                     int n = n1 - n2;
                     return
                         ((n ^ n1) < 0 && (n ^ ~n2) < 0) // overflow check
-                        ? (Number) Long.valueOf(((long) n1) - n2)
-                        : (Number) Integer.valueOf(n);
+                        ? Long.valueOf(((long) n1) - n2)
+                        : Integer.valueOf(n);
                 }
                 case LONG: {
                     long n1 = first.longValue();
@@ -310,8 +310,8 @@ public abstract class ArithmeticEngine {
                     long n = n1 - n2;
                     return
                         ((n ^ n1) < 0 && (n ^ ~n2) < 0) // overflow check
-                        ? (Number) toBigInteger(first).subtract(toBigInteger(second))
-                        : (Number) Long.valueOf(n);
+                        ? toBigInteger(first).subtract(toBigInteger(second))
+                        : Long.valueOf(n);
                 }
                 case FLOAT: {
                     return Float.valueOf(first.floatValue() - second.floatValue());
@@ -344,8 +344,8 @@ public abstract class ArithmeticEngine {
                     int n = n1 * n2;
                     return
                         n1 == 0 || n / n1 == n2 // overflow check
-                        ? (Number) Integer.valueOf(n)
-                        : (Number) Long.valueOf(((long) n1) * n2);
+                        ? Integer.valueOf(n)
+                        : Long.valueOf(((long) n1) * n2);
                 }
                 case LONG: {
                     long n1 = first.longValue();
@@ -353,8 +353,8 @@ public abstract class ArithmeticEngine {
                     long n = n1 * n2;
                     return
                         n1 == 0L || n / n1 == n2 // overflow check
-                        ? (Number) Long.valueOf(n)
-                        : (Number) toBigInteger(first).multiply(toBigInteger(second));
+                        ? Long.valueOf(n)
+                        : toBigInteger(first).multiply(toBigInteger(second));
                 }
                 case FLOAT: {
                     return Float.valueOf(first.floatValue() * second.floatValue());

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/BuiltInsForNumbers.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/BuiltInsForNumbers.java b/src/main/java/org/apache/freemarker/core/ast/BuiltInsForNumbers.java
index 93f364f..21d4cd2 100644
--- a/src/main/java/org/apache/freemarker/core/ast/BuiltInsForNumbers.java
+++ b/src/main/java/org/apache/freemarker/core/ast/BuiltInsForNumbers.java
@@ -270,7 +270,7 @@ class BuiltInsForNumbers {
 
     private static final long safeToLong(Number num) throws TemplateModelException {
         if (num instanceof Double) {
-            double d = Math.round(((Double) num).doubleValue());
+            double d = Math.round(num.doubleValue());
             if (d > Long.MAX_VALUE || d < Long.MIN_VALUE) {
                 throw new _TemplateModelException(
                         "Number doesn't fit into a 64 bit signed integer (long): ", Double.valueOf(d));
@@ -278,7 +278,7 @@ class BuiltInsForNumbers {
                 return (long) d;
             }
         } else if (num instanceof Float) {
-            float f = Math.round(((Float) num).floatValue());
+            float f = Math.round(num.floatValue());
             if (f > Long.MAX_VALUE || f < Long.MIN_VALUE) {
                 throw new _TemplateModelException(
                         "Number doesn't fit into a 64 bit signed integer (long): ", Float.valueOf(f));

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/Configurable.java b/src/main/java/org/apache/freemarker/core/ast/Configurable.java
index d481944..c0df514 100644
--- a/src/main/java/org/apache/freemarker/core/ast/Configurable.java
+++ b/src/main/java/org/apache/freemarker/core/ast/Configurable.java
@@ -2542,14 +2542,14 @@ public class Configurable {
             super(env,
                     "Unknown FreeMarker configuration setting: ", new _DelayedJQuote(name),
                     correctedName == null
-                            ? (Object) "" : new Object[] { ". You may meant: ", new _DelayedJQuote(correctedName)
});
+                            ? "" : new Object[] { ". You may meant: ", new _DelayedJQuote(correctedName)
});
         }
 
         private UnknownSettingException(Environment env, String name, Version removedInVersion)
{
             super(env,
                     "Unknown FreeMarker configuration setting: ", new _DelayedJQuote(name),
                     removedInVersion == null
-                            ? (Object) "" : new Object[] { ". This setting was removed in
version ", removedInVersion });
+                            ? "" : new Object[] { ". This setting was removed in version
", removedInVersion });
         }
         
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/Dot.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/Dot.java b/src/main/java/org/apache/freemarker/core/ast/Dot.java
index 8bfc4e9..c3b3931 100644
--- a/src/main/java/org/apache/freemarker/core/ast/Dot.java
+++ b/src/main/java/org/apache/freemarker/core/ast/Dot.java
@@ -76,7 +76,7 @@ final class Dot extends Expression {
 
     @Override
     Object getParameterValue(int idx) {
-        return idx == 0 ? (Object) target : (Object) key;
+        return idx == 0 ? target : key;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/EvalUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/EvalUtil.java b/src/main/java/org/apache/freemarker/core/ast/EvalUtil.java
index 6170e99..a55769d 100644
--- a/src/main/java/org/apache/freemarker/core/ast/EvalUtil.java
+++ b/src/main/java/org/apache/freemarker/core/ast/EvalUtil.java
@@ -285,12 +285,12 @@ class EvalUtil {
                     "Left hand operand ",
                     (quoteOperandsInErrors && leftExp != null
                             ? new Object[] { "(", new _DelayedGetCanonicalForm(leftExp),
") value " }
-                            : (Object) ""),
+                            : ""),
                     "is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(leftValue)),
".\n",
                     "Right hand operand ",
                     (quoteOperandsInErrors && rightExp != null
                             ? new Object[] { "(", new _DelayedGetCanonicalForm(rightExp),
") value " }
-                            : (Object) ""),
+                            : ""),
                     "is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(rightValue)),
                     ".");
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/MessageUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/MessageUtil.java b/src/main/java/org/apache/freemarker/core/ast/MessageUtil.java
index 9436654..9e53b50 100644
--- a/src/main/java/org/apache/freemarker/core/ast/MessageUtil.java
+++ b/src/main/java/org/apache/freemarker/core/ast/MessageUtil.java
@@ -303,8 +303,8 @@ class MessageUtil {
                 e.getMessage())
                 .blame(dataSrcExp); 
         return useTempModelExc
-                ? new _TemplateModelException(e, (Environment) null, desc)
-                : new _MiscTemplateException(e, (Environment) null, desc);
+                ? new _TemplateModelException(e, null, desc)
+                : new _MiscTemplateException(e, null, desc);
     }
     
     static TemplateException newCantFormatNumberException(TemplateNumberFormat format, Expression
dataSrcExp,
@@ -314,8 +314,8 @@ class MessageUtil {
                 e.getMessage())
                 .blame(dataSrcExp); 
         return useTempModelExc
-                ? new _TemplateModelException(e, (Environment) null, desc)
-                : new _MiscTemplateException(e, (Environment) null, desc);
+                ? new _TemplateModelException(e, null, desc)
+                : new _MiscTemplateException(e, null, desc);
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/ParseException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/ParseException.java b/src/main/java/org/apache/freemarker/core/ast/ParseException.java
index 26ba8e4..03cec71 100644
--- a/src/main/java/org/apache/freemarker/core/ast/ParseException.java
+++ b/src/main/java/org/apache/freemarker/core/ast/ParseException.java
@@ -131,7 +131,7 @@ public class ParseException extends IOException implements FMParserConstants
{
      */
     @Deprecated
     public ParseException(String description, int lineNumber, int columnNumber) {
-        this(description, (Template) null, lineNumber, columnNumber, null);
+        this(description, null, lineNumber, columnNumber, null);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/Range.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/Range.java b/src/main/java/org/apache/freemarker/core/ast/Range.java
index 14f42f6..949fd53 100644
--- a/src/main/java/org/apache/freemarker/core/ast/Range.java
+++ b/src/main/java/org/apache/freemarker/core/ast/Range.java
@@ -57,8 +57,8 @@ final class Range extends Expression {
                     endType == END_INCLUSIVE, endType == END_SIZE_LIMITED); 
         } else {
             return _TemplateAPI.getTemplateLanguageVersionAsInt(this) >= _TemplateAPI.VERSION_INT_2_3_21
-                    ? (RangeModel) new ListableRightUnboundedRangeModel(begin)
-                    : (RangeModel) new NonListableRightUnboundedRangeModel(begin);
+                    ? new ListableRightUnboundedRangeModel(begin)
+                    : new NonListableRightUnboundedRangeModel(begin);
         }
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/ast/UnexpectedTypeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/UnexpectedTypeException.java b/src/main/java/org/apache/freemarker/core/ast/UnexpectedTypeException.java
index 28fa8dc..12f5e03 100644
--- a/src/main/java/org/apache/freemarker/core/ast/UnexpectedTypeException.java
+++ b/src/main/java/org/apache/freemarker/core/ast/UnexpectedTypeException.java
@@ -98,7 +98,7 @@ public class UnexpectedTypeException extends TemplateException {
         return new Object[] {
                 "Expected ", new _DelayedAOrAn(expectedTypesDesc), ", but ",
                 (blamedAssignmentTargetVarName == null
-                        ? (Object) (blamed != null ? "this" : "the expression")
+                        ? blamed != null ? "this" : "the expression"
                         : new Object[] {
                                 "assignment target variable ",
                                 new _DelayedJQuote(blamedAssignmentTargetVarName) }), 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java b/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
index 1115090..e3be688 100644
--- a/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
+++ b/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
@@ -41,8 +41,8 @@ public abstract class DebuggerService {
         // RMI service.
         return 
             _SecurityUtil.getSystemProperty("org.apache.freemarker.core.debug.password",
null) == null
-            ? (DebuggerService) new NoOpDebuggerService()
-            : (DebuggerService) new RmiDebuggerService();
+            ? new NoOpDebuggerService()
+            : new RmiDebuggerService();
     }
 
     public static List getBreakpoints(String templateName) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java b/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
index 01e6f0b..35c0af7 100644
--- a/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
+++ b/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
@@ -33,7 +33,7 @@ public class TemplateModelException extends TemplateException {
      * specified detail message.
      */
     public TemplateModelException() {
-        this((String) null, null);
+        this(null, null);
     }
 
     /**
@@ -51,7 +51,7 @@ public class TemplateModelException extends TemplateException {
      * backward-compatibility.
      */
     public TemplateModelException(Exception cause) {
-        this((String) null, cause);
+        this(null, cause);
     }
 
     /**
@@ -62,7 +62,7 @@ public class TemplateModelException extends TemplateException {
      * exception to be raised
      */
     public TemplateModelException(Throwable cause) {
-        this((String) null, cause);
+        this(null, cause);
     }
 
     

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
b/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
index 92d5970..511295c 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
@@ -115,7 +115,7 @@ public class DefaultNonListCollectionAdapter extends WrappingTemplateModel
imple
         } catch (ClassCastException e) {
             throw new _TemplateModelException(e,
                     "Failed to check if the collection contains the item. Probably the item's
Java type, ",
-                    itemPojo != null ? new _DelayedShortClassName(itemPojo.getClass()) :
(Object) "Null",
+                    itemPojo != null ? new _DelayedShortClassName(itemPojo.getClass()) :
"Null",
                     ", doesn't match the type of (some of) the collection items; see cause
exception.");
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
b/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
index 8c9ee1e..ba474c9 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
@@ -181,8 +181,8 @@ public class DefaultObjectWrapper extends org.apache.freemarker.core.model.impl.
                     return DefaultListAdapter.adapt((List<?>) obj, this);
                 } else {
                     return forceLegacyNonListCollections
-                            ? (TemplateModel) new SimpleSequence((Collection<?>) obj,
this)
-                            : (TemplateModel) DefaultNonListCollectionAdapter.adapt((Collection<?>)
obj, this);
+                            ? new SimpleSequence((Collection<?>) obj, this)
+                            : DefaultNonListCollectionAdapter.adapt((Collection<?>)
obj, this);
                 }
             } else {
                 return new SimpleSequence((Collection<?>) obj, this);
@@ -190,16 +190,16 @@ public class DefaultObjectWrapper extends org.apache.freemarker.core.model.impl.
         }
         if (obj instanceof Map) {
             return useAdaptersForContainers
-                    ? (TemplateModel) DefaultMapAdapter.adapt((Map<?, ?>) obj, this)
-                    : (TemplateModel) new SimpleHash((Map<?, ?>) obj, this);
+                    ? DefaultMapAdapter.adapt((Map<?, ?>) obj, this)
+                    : new SimpleHash((Map<?, ?>) obj, this);
         }
         if (obj instanceof Boolean) {
             return obj.equals(Boolean.TRUE) ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
         }
         if (obj instanceof Iterator) {
             return useAdaptersForContainers
-                    ? (TemplateModel) DefaultIteratorAdapter.adapt((Iterator<?>) obj,
this)
-                    : (TemplateModel) new SimpleCollection((Iterator<?>) obj, this);
+                    ? DefaultIteratorAdapter.adapt((Iterator<?>) obj, this)
+                    : new SimpleCollection((Iterator<?>) obj, this);
         }
         if (iterableSupport && obj instanceof Iterable) {
             return DefaultIterableAdapter.adapt((Iterable<?>) obj, this);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/model/impl/beans/ModelCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/ModelCache.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/ModelCache.java
index 779441e..605ef14 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/ModelCache.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/ModelCache.java
@@ -136,7 +136,7 @@ public abstract class ModelCache {
         }
 
         TemplateModel getModel() {
-            return (TemplateModel) this.get();
+            return this.get();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/model/impl/beans/OverloadedMethods.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/OverloadedMethods.java
b/src/main/java/org/apache/freemarker/core/model/impl/beans/OverloadedMethods.java
index 2682e25..91ce78c 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/OverloadedMethods.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/OverloadedMethods.java
@@ -135,12 +135,12 @@ final class OverloadedMethods {
                 tmArgs != null
                         ? new Object[] {
                                 "\nThe FTL type of the argument values were: ", getTMActualParameterTypes(tmArgs),
"." }
-                        : (Object) "",
+                        : "",
                 unwrappedArgs != null
                         ? new Object[] {
                                 "\nThe Java type of the argument values were: ",
                                 getUnwrappedActualParameterTypes(unwrappedArgs) + "." }
-                        : (Object) ""};
+                        : ""};
     }
 
     private _DelayedConversionToString memberListToString() {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
index 3271371..98b8dec 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
@@ -283,7 +283,7 @@ public final class _MethodUtil {
         return new _TemplateModelException(e,
                 invocationErrorMessageStart(member, isConstructor),
                 " threw an exception",
-                isStatic || isConstructor ? (Object) "" : new Object[] {
+                isStatic || isConstructor ? "" : new Object[] {
                     " when invoked on ", parentObject.getClass(), " object ", new _DelayedJQuote(parentObject)

                 },
                 "; see cause exception in the Java stack trace.");

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java b/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
index 2575bc5..fdf2851 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
@@ -157,7 +157,7 @@ class NodeListModel extends SimpleSequence implements TemplateHashModel,
_Unexpe
             for (int i = 0; i < size(); i++) {
                 NodeModel nm = (NodeModel) get(i);
                 if (nm instanceof ElementModel) {
-                    TemplateSequenceModel tsm = (TemplateSequenceModel) ((ElementModel) nm).get(key);
+                    TemplateSequenceModel tsm = (TemplateSequenceModel) nm.get(key);
                     if (tsm != null) {
                         int size = tsm.size();
                         for (int j = 0; j < size; j++) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/servlet/IncludePage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/servlet/IncludePage.java b/src/main/java/org/apache/freemarker/servlet/IncludePage.java
index 2889ab2..09f5182 100644
--- a/src/main/java/org/apache/freemarker/servlet/IncludePage.java
+++ b/src/main/java/org/apache/freemarker/servlet/IncludePage.java
@@ -227,7 +227,7 @@ public class IncludePage implements TemplateDirectiveModel {
         @Override
         public String[] getParameterValues(String name) {
             String[] value = ((String[]) paramsMap.get(name));
-            return value != null ? (String[]) value.clone() : null;
+            return value != null ? value.clone() : null;
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java b/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
index e96f89b..eb2896b 100644
--- a/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
+++ b/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
@@ -114,7 +114,7 @@ class JspTagModelBase {
                                 " (declared type: ", new _DelayedShortClassName(setterType)
                                 + ", actual value's type: ",
                                 (argArray[0] != null
-                                        ? (Object) new _DelayedShortClassName(argArray[0].getClass())
: "Null"),
+                                        ? new _DelayedShortClassName(argArray[0].getClass())
: "Null"),
                                 "). See cause exception for the more specific cause...");
                         if (e instanceof IllegalArgumentException && !(setterType.isAssignableFrom(String.class))
                                 && argArray[0] != null && argArray[0] instanceof
String) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java b/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
index d65890b..c8c7e2a 100644
--- a/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
+++ b/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
@@ -239,9 +239,9 @@ public class TaglibFactory implements TemplateHashModel {
                     }
 
                     tldLocation = isJarPath(normalizedTaglibUri)
-                                ? (TldLocation) new ServletContextJarEntryTldLocation(
+                                ? new ServletContextJarEntryTldLocation(
                                         normalizedTaglibUri, DEFAULT_TLD_RESOURCE_PATH)
-                                : (TldLocation) new ServletContextTldLocation(normalizedTaglibUri);
+                                : new ServletContextTldLocation(normalizedTaglibUri);
                 }
             } catch (Exception e) {
                 String failedTLDsList = failedTldListAlreadyIncluded ? null : getFailedTLDsList();
@@ -1563,9 +1563,9 @@ public class TaglibFactory implements TemplateHashModel {
             } else if (E_TAGLIB.equals(qName)) {
                 addTldLocation(
                         isJarPath(taglibLocationCData)
-                                ? (TldLocation) new ServletContextJarEntryTldLocation(
+                                ? new ServletContextJarEntryTldLocation(
                                         taglibLocationCData, DEFAULT_TLD_RESOURCE_PATH)
-                                : (TldLocation) new ServletContextTldLocation(taglibLocationCData),
+                                : new ServletContextTldLocation(taglibLocationCData),
                         taglibUriCData);
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18843c03/src/test/java/org/apache/freemarker/core/ast/PrintfGTemplateNumberFormatFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/ast/PrintfGTemplateNumberFormatFactory.java
b/src/test/java/org/apache/freemarker/core/ast/PrintfGTemplateNumberFormatFactory.java
index db897c7..4382c4b 100644
--- a/src/test/java/org/apache/freemarker/core/ast/PrintfGTemplateNumberFormatFactory.java
+++ b/src/test/java/org/apache/freemarker/core/ast/PrintfGTemplateNumberFormatFactory.java
@@ -87,7 +87,7 @@ public class PrintfGTemplateNumberFormatFactory extends TemplateNumberFormatFact
                 if (n instanceof BigInteger) {
                     gCompatibleN = new BigDecimal((BigInteger) n);                      
 
                 } else if (n instanceof Long) {
-                    gCompatibleN = BigDecimal.valueOf(((Long) n).longValue());
+                    gCompatibleN = BigDecimal.valueOf(n.longValue());
                 } else {
                     gCompatibleN = Double.valueOf(n.doubleValue());
                 }


Mime
View raw message