|
Aaron Bartell asked:
>This is a theoretical question that I just came up with.
>How would I compile class A which utilizes class B and compile class B
that
>utilizes class A? Since they use each other they wont compile until the
>other one is compiled. I am figuring there must be a way out of this.
At least once this was not theoretical for me. It can come up when a
parent class downcasts to a child.
What I have done is have a dummy version of the parent with all methods
present but with null implementations. I compiled that, and then compiled
the child. Only then can I compile the real parent. (Or, was it dummy
child, compile parent, compile child; either would work, I would think).
Once you get things "bootstrapped" this way, there is a .class file out
there with the methods defined for the "other one". For Java, this seems
to be enough to permit the compile; it doesn't do dependencies by source,
only by class file. So, as long as there's a valid class file out there,
you ordinarily don't have to do it again, though I seem to recall having to
do this about three times, maybe when adding further children.
Larry W. Loen - Senior Java and AS/400 Performance Analyst
Dept HP4, Rochester MN
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.