Menu

#14 No execs

open
nobody
None
7
2005-04-14
2005-04-14
No

See if we can figure out a way to avoid exec'ing the
compiler; possibly by directly invoking the Compiler
classes; even if that means we have to use the
sun.tools.javac classes. Possibly we should bundle
Jikes. Possibly we should use an appropriate design
pattern to abstract away the necessary services of the
compiler and adapt to different compiler interfaces,
and pick what's available.

This might also allow us more control over the classpath.

Discussion

  • Remko Popma

    Remko Popma - 2005-04-18

    Logged In: YES
    user_id=544920

    1. Why do you want to do this?
    If you want to improve performance by avoiding forking
    too many processes, an alternative would be to refactor
    FileBasedClassSourceCodeChanger so that recompilation is
    batched over multiple changes.
    I don't see how using the sun.tools.javac classes will
    help with the classpath issue.

    2. Ant uses a factory pattern and supports eight different
    compilers. Perhaps look here for ideas? (Big increase in
    complexity, though: the ant.taskdefs.compilers package alone
    is just as big as the main jester package...)

     
  • Elliotte Rusty Harold

    Logged In: YES
    user_id=226817

    Two reasons:

    1. Ease of use: getting the classpath and file layout just
    right to run Jester is a major pain. Anything we can do to
    improve that is a major help. (Explicitly invoking the
    compiler might not actually do that, but I'm not sure of
    that yet.)

    2. exec is very platform dependent. Multiple versions of
    Jester have broken on my Mac till I patched around this very
    issue. Now that I'm using a Mac for primary development, we
    might have the opposite problem and start breaking on
    Windows. It's better to use classes that are more likely to
    run consistently across platforms without having to test
    each one every time you make a small change.

     
  • Elliotte Rusty Harold

    Logged In: YES
    user_id=226817

    Take a look at Apache Commons JCI:
    http://jakarta.apache.org/commons/sandbox/jci/index.html

    Also see the Janino and Eclipse compilers.

     
  • Curt Cox

    Curt Cox - 2006-10-18

    Logged In: YES
    user_id=540

    "JSR 199: Java Compiler API"
    http://jcp.org/en/jsr/detail?id=199

     

Log in to post a comment.