OpenJDK parser internals
Steve S
vstrength at gmail.com
Sun Sep 25 12:27:13 PDT 2011
Hi All,
I'm just started deeply digging into OpenJDK sources (jdk6, langtools).
The following strikes me as odd:
1. Ast tree members (JCTree descendants) expose all theirs members in public
access.
Do I understand right that this is done due to: (1) simplicity, (2)
performance gain?
Is the option to rewrite it with final fields and getters ever considered?
2. Lots of code with old-fashioned for-loop instead of for-each loop (e.g.
iterating over internal linked List).
3. Verbose exception handling approach - e.g. .tools.javac.tree.Pretty - all
the visitor methods wraps implementation in try-catch block though it is
sufficient to provide Pretty.print implementation that only wraps out.write
to try-catch block with throwing UncheckedIOException.
4... Lots of other stuff like code duplication, violation of encapsulation,
etc.
Does someone have a "plan" to refactor this code? I never ever seen in the
jdk7, 8 forks - may be it's worth it?
Looks like it'd be a real pain due to lots of forks and would result in a
outrageously complex merge.
---
Best Regards,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20110925/b42e2ba8/attachment.html
More information about the compiler-dev
mailing list