Mercurial > hg > truffle
changeset 19850:be176e7088ed
Relax check invariants for usage of ==.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 14 Mar 2015 14:03:59 +0100 |
parents | bcc0069dba6f |
children | 88e8fe50ccac |
files | graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Sat Mar 14 13:19:16 2015 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Sat Mar 14 14:03:59 2015 +0100 @@ -107,7 +107,11 @@ for (ObjectEqualsNode cn : graph.getNodes().filter(ObjectEqualsNode.class)) { // bail out if we compare an object of type klass with == or != (except null checks) ResolvedJavaMethod method = graph.method(); - if (isIllegalUsage(method, cn.getX(), cn.getY(), context.getMetaAccess()) || isIllegalUsage(method, cn.getY(), cn.getX(), context.getMetaAccess())) { + ResolvedJavaType restrictedType = context.getMetaAccess().lookupJavaType(restrictedClass); + + if (method.getDeclaringClass().equals(restrictedType)) { + // Allow violation in methods of the restricted type itself. + } else if (isIllegalUsage(method, cn.getX(), cn.getY(), context.getMetaAccess()) || isIllegalUsage(method, cn.getY(), cn.getX(), context.getMetaAccess())) { throw new VerificationError("Verification of " + restrictedClass.getName() + " usage failed: Comparing " + cn.getX() + " and " + cn.getY() + " in " + method + " must use .equals() for object equality, not '==' or '!='"); }