Bug 341842 - give option to use Oracle Javac
Summary: give option to use Oracle Javac
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.7 RC1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-04 16:49 EDT by Gabriele CLA
Modified: 2011-05-16 00:27 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriele CLA 2011-04-04 16:49:41 EDT
Build Identifier: 

I'd like to specify which Java Compiler is used to compile my code in Eclipse. 
This is supported in other IDEs such IDEA, and is useful to those having to use a particular compiler either for research [1], policy [2], or functionality[3][4].

[1] http://portal.acm.org/citation.cfm?id=1082285
[2] http://stackoverflow.com/questions/4163312/how-to-set-up-other-that-eclipse-java-compiler-for-eclipse-ide/4163436#4163436
[3] http://dp4j.com/faq
[4] http://www.eclipse.org/forums/index.php?t=msg&goto=547667&

Reproducible: Always
Comment 1 Ayushman Jain CLA 2011-04-05 06:28:34 EDT
Hi Gabriele, Eclipse uses its own compiler - Eclipse Compiler for JAVA (ECJ). You can specify compatibility levels to make it compatible with a particular version of the Sun/Oracle java compiler.
If you want to use javac to build, you can use Ant tasks as described in links [2] and [4].
What exactly is the request being raised in this bug?
Comment 2 Gabriele CLA 2011-04-05 06:49:56 EDT
(In reply to comment #1)
> Hi Gabriele, Eclipse uses its own compiler - Eclipse Compiler for JAVA (ECJ).
> You can specify compatibility levels to make it compatible with a particular
> version of the Sun/Oracle java compiler.
> If you want to use javac to build, you can use Ant tasks as described in links
> [2] and [4].
> What exactly is the request being raised in this bug?

Thank you for replying. I've not tried with Ant, but with Maven as in [3].
The request here is to have the option to choose the Oracle's Java Compiler  through Eclipse interface. 
To support [1,2,4] you make it possible to specify any custom compiler, but that's extra.
The Maven/Ant solutions otherwise are work-arounds. Yes, at the end of the abstraction it's what Eclipse will do, but (1) it's Eclipse doing it (2) it's Eclipse supporting it as a feature. [2,3] show that it becomes tricky and undocumented to maintain IDE-wide support (warnings, errors, problems,etc..)  once another compiler is chosen.

In the words of [2] we'd like a comparable feature to IDEA's Multiple compilers support[5].


[5] http://www.jetbrains.com/idea/features/compiler.html#link1
Comment 3 Ayushman Jain CLA 2011-04-05 09:11:54 EDT
Dani, what do you think about this?
Comment 4 Dani Megert CLA 2011-04-05 09:22:11 EDT
The whole JDT tooling is based on the enhanced Eclipse compiler which cannot be replaced as this would let lots of additional features fail. However, as already said in comment 1, it is possible to replace a project's 'Java Builder' with an 'Ant Builder' that calls the 'javac' task (see 'Builders' project property page inside the IDE).

We won't go beyond that.
Comment 5 Srikanth Sankaran CLA 2011-05-16 00:27:22 EDT
Verified for 3.7 RC1