Closed Bug 1228684 Opened 4 years ago Closed 4 years ago

Annotation processor fails with --disable-webrtc

Categories

(Firefox for Android :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 45
Tracking Status
firefox45 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

Details

Attachments

(1 file)

There's an unfortunate interaction with the annotation processor and --disable-webrtc.  (It's a latent bug that just happens to be exposed by --disable-webrtc.)

The issue is that hasNext() [1] and next() [2] don't necessarily agree.  If the final class seen is an anonymous inner class (or the other case handled specially), we'll request next() when we can't actually do so.  We can't return null at this point, either, since we've already answered true to the previous hasNext().  Setting --disable-webrtc happens to trigger this; francois can attach the log.

[1] https://dxr.mozilla.org/mozilla-central/rev/47b49b0d32360fab04b11ff9120970979c426911/build/annotationProcessors/classloader/JarClassIterator.java#22

[2] https://dxr.mozilla.org/mozilla-central/rev/47b49b0d32360fab04b11ff9120970979c426911/build/annotationProcessors/classloader/JarClassIterator.java#46
I see two fixes.  The first is to address this in our ordering.  That is, put enclosed classes before enclosing classes, so that the comment at https://dxr.mozilla.org/mozilla-central/rev/47b49b0d32360fab04b11ff9120970979c426911/build/annotationProcessors/classloader/JarClassIterator.java#45 is more sensible and we really always see the enclosing classes later.  This won't prevent the other special case, at https://dxr.mozilla.org/mozilla-central/rev/47b49b0d32360fab04b11ff9120970979c426911/build/annotationProcessors/classloader/JarClassIterator.java#40.

Or we can stop lying in hasNext().  This is tricky, since we'd have to peek at the underlying iterator and figure out up-front if we can process it successfully.  That means storing our result to return in next(); and handling the case where we called next() before hasNext(), etc.  Not rocket science, but finicky.  I'll have a crack at the latter now.
Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Attachment #8693112 - Flags: review?(nchen) → review+
Comment on attachment 8693112 [details]
MozReview Request: Bug 1228684 - Make annotation processor handle unusual final cases. r?jchen

https://reviewboard.mozilla.org/r/26401/#review24051

LGTM
https://hg.mozilla.org/mozilla-central/rev/4bc4ce69937d
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
You need to log in before you can comment on or make changes to this bug.