Scanning Methods

I'm trying to write an annotation processor that generates some new source files. As a matter of safety, unless the class I'm scanning was also generated by this annotation processor, I want to issue a warning when I encounter methods that have the same signature as the methods I generate.

I've gotten to the point where I can iterate over all of the methods in the class, and I have retrieved Name objects for them, but when I try to match the name with a string containing the same content, the comparison fails. I've been using Name.contentEquals(CharSequence)

.

When I replace this check with a for loop that iterates over the full length of both the string I've been comparing with, and the Name object, the characters all match.

Any idea why the name match fails, and is there a better/faster way to check if a method's signature might conflict with one you plan on generating?

Thanks,

lame?

[948 byte] By [lame?a] at [2007-11-27 1:03:52]
# 1

[snip]

> I've gotten to the point where I can iterate over

> all of the methods in the class, and I have retrieved

> Name objects for them, but when I try to match the

> name with a string containing the same content, the

> comparison fails. I've been using

> Name.contentEquals(CharSequence)

.

>

> When I replace this check with a for loop that

> iterates over the full length of both the string I've

> been comparing with, and the Name object, the

> characters all match.

>

> Any idea why the name match fails, and is there a

> better/faster way to check if a method's signature

> might conflict with one you plan on generating?

Sounds like your approach should work; posting a condensed processor and input that demonstrates the problem might help track down what is going on.

j.d.darcya at 2007-7-11 23:38:57 > top of Java-index,Core,Core APIs...
# 2

Hmm,

The problem seems to have resolved itself. I commented out a bit of code above my comparison and recompiled again, and I found a positive match using contentEquals. I then uncommented it again, and everything continued to work.

Since I can't reproduce it reliably anymore, I'm gonna assume I screwed up or it just didn't recompile some part correctly the last few times.

Thanks for the assistance, and sorry if I wasted your time.

~ Flame

lame?a at 2007-7-11 23:38:57 > top of Java-index,Core,Core APIs...