<div dir="ltr"><div dir="ltr"><div>In JavaCompiler.java, there is code that looks like this:<br></div><div><br></div><div><span style="font-family:monospace"> JavaFileObject prev = log.useSource(<b>env.enclClass.sym.sourcefile != null ?<br> env.enclClass.sym.sourcefile :<br> env.toplevel.sourcefile</b>);</span></div><div><span style="font-family:monospace"> try {</span></div><div><span style="font-family:monospace"> ... do something ...<br></span></div><div><span style="font-family:monospace"> } finally {<br></span></div><div><span style="font-family:monospace"> log.useSource(prev);<br></span></div><div><span style="font-family:monospace"> }</span></div><div><br></div><div>I don't understand why the boldface part is needed. How would it ever be possible for a class A to have an enclosing class B that exists in a different source file?</div><div><br></div><div>Put another way, isn't <span style="font-family:monospace">env.toplevel.sourcefile</span> always the source file that corresponds to any class being compiled?<br></div><div><br></div><div>Thanks for any clarifications.</div><div><br></div><div>-Archie<br></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Archie L. Cobbs<br></div></div>
</div>