Attr.java: 962-965

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Apr 10 16:58:37 PDT 2013


The following lines check whether the name of the receiver parameter is 
correct:

                     {
                         // Make sure the receiver parameter name is as 
expected
                         String fnd = tree.recvparam.nameexpr.toString();
                         String exp = 
recvtype.unannotatedType().toString() + '.' + names._this.toString();
                         if (!exp.endsWith(fnd)) {
                             log.error(tree.recvparam.pos(), 
"receiver.parameter.wrong.name", exp, fnd);
                         }
                     }

Doing string arithmetic and comparison like this is just plain wrong.  
It needs to be semantic comparison of the expression, either as names or 
as types.

-- Jon


More information about the type-annotations-dev mailing list