Author: gwoolsey
Date: Tue Feb 14 22:00:05 2017
New Revision: 1783035

URL: http://svn.apache.org/viewvc?rev=1783035&view=rev
Log:
Change logic to avoid a 1.6 compiler bug that doesn't properly handle generics. 
 Eclipse compiler and JDK > 1.6 work properly, even with target runtime = 1.6, 
so I didn't see it locally.  had to compile with the same version of the JDK as 
the build machine to see the problem.

Modified:
    
poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java

Modified: 
poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java?rev=1783035&r1=1783034&r2=1783035&view=diff
==============================================================================
--- 
poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
 (original)
+++ 
poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java
 Tue Feb 14 22:00:05 2017
@@ -594,16 +594,18 @@ public class EvaluationConditionalFormat
         },
         EQUAL {
             public <C extends Comparable<C>> boolean isValid(C cellValue, C 
v1, C v2) {
-                if (cellValue instanceof String) {
-                    return ((String) cellValue).compareToIgnoreCase((String) 
v1) == 0;
+                // need to avoid instanceof, to work around a 1.6 compiler bug
+                if (cellValue.getClass() == String.class) {
+                    return 
cellValue.toString().compareToIgnoreCase(v1.toString()) == 0;
                 }
                 return cellValue.compareTo(v1) == 0;
             }
         },
         NOT_EQUAL {
             public <C extends Comparable<C>> boolean isValid(C cellValue, C 
v1, C v2) {
-                if (cellValue instanceof String) {
-                    return ((String) cellValue).compareToIgnoreCase((String) 
v1) != 0;
+                // need to avoid instanceof, to work around a 1.6 compiler bug
+                if (cellValue.getClass() == String.class) {
+                    return 
cellValue.toString().compareToIgnoreCase(v1.toString()) == 0;
                 }
                 return cellValue.compareTo(v1) != 0;
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to