{"action":"opened","issue":{"url":"https://api.github.com/repos/mybatis/mybatis-3/issues/584","repository_url":"https://api.github.com/repos/mybatis/mybatis-3","labels_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/584/labels{/name}","comments_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/584/comments","events_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/584/events","html_url":"https://github.com/mybatis/mybatis-3/issues/584","id":135450374,"number":584,"title":"OgnlOps#isEqual comparison of two enum thrown IllegalArgumentException","user":{"login":"Vacoor","id":4110876,"avatar_url":"https://avatars.githubusercontent.com/u/4110876?v=3","gravatar_id":"","url":"https://api.github.com/users/Vacoor","html_url":"https://github.com/Vacoor","followers_url":"https://api.github.com/users/Vacoor/followers","following_url":"https://api.github.com/users/Vacoor/following{/other_user}","gists_url":"https://api.github.com/users/Vacoor/gists{/gist_id}","starred_url":"https://api.github.com/users/Vacoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vacoor/subscriptions","organizations_url":"https://api.github.com/users/Vacoor/orgs","repos_url":"https://api.github.com/users/Vacoor/repos","events_url":"https://api.github.com/users/Vacoor/events{/privacy}","received_events_url":"https://api.github.com/users/Vacoor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-22T15:25:02Z","updated_at":"2016-02-22T15:25:02Z","closed_at":null,"body":"OgnlOps#isEqual comparison of two enum thrown IllegalArgumentException\r\n-----------------------\r\nhttps://github.com/jkuhnert/ognl/issues/15\r\n\r\nOnly in this case：\r\nenum Op {\r\n    NE(\"<>\"),      // getClass() is \"Op$1\"\r\n    EQ(\"=\")         // getClass() is \"Op$2\"\r\n}\r\nOp.NE.getClass(). isAssignableFrom(Op.EQ.getClass())   // false\r\n\r\nNow:\r\n----------------------------------\r\n    OgnlOps#isEqual(Object, Object)    // line 124 \r\n    is\r\n    result = (object1 != null) && (object2 != null)\r\n                        && (object1.equals(object2) || (compareWithConversion(object1, object2) == 0));\r\n\r\n    OgnlOps#compareWithConversion(Object, Object)   // line 87 ~ 95\r\n    if ((t1 == NONNUMERIC) && (t2 == NONNUMERIC)) {\r\n                    // **FIXME: when enum is abstract**\r\n                    if ((v1 instanceof Comparable) && v1.getClass().isAssignableFrom(v2.getClass())) {\r\n                        result = ((Comparable) v1).compareTo(v2);\r\n                        break;\r\n                    } else {\r\n                        throw new IllegalArgumentException(\"invalid comparison: \" + v1.getClass().getName() + \" and \"\r\n                                + v2.getClass().getName());\r\n                    }\r\n                }\r\n----------------------------------------------------------\r\nTemporary solution\r\n    \"Op.NE.name() == 'NE'\"\r\n\r\nTip:\r\n-------------\r\n    before version is ok;\r\n    OgnlOps#isEqual(Object, Object) \r\n        result = compareWithConversion(object1, object2, true) == 0 || object1.equals(object2);\r\n     OgnlOps#compareWithConversion(Object, Object, boolean)\r\n       if(!equals) {   // **HERE because equals args is true **\r\n             throw new IllegalArgumentException(\"invalid comparison: \" + v1.getClass().getName() + \" and \" + v2.getClass().getName());\r\n       }"}}