Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 510334

Summary: Compilation silently aborted when apt is not on the classpath
Product: [Eclipse Project] JDT Reporter: Sven Efftinge <sven.efftinge>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: christian.dietrich.opensource, jarthana, jeffrey.a.cummings, manoj.palat, stephan.herrmann
Version: 4.7   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Sven Efftinge CLA 2017-01-12 03:01:09 EST
The commit https://github.com/eclipse/eclipse.jdt.core/commit/7054404d86f8354c8460ac79576bdc4596325207#diff-f1e9019eddec6f02301c09d80d24f5f5L4027

changed the behavior of the batch compiler for cases where 'BatchAnnotationProcessorManager' is missing on the classpath.
It used to be ignored but 'now' aborts the compilation.

It got revealed only now because of the latest jdt.core 3.12.2 release on maven central.
Comment 1 Jeffrey Cummings CLA 2017-06-28 12:36:05 EDT
How can you possibly not fix this immediately.  The Eclipse javac compiler is unusable from the command line, and the fix has to be trivial.  The result of this bug is that users who need to build from the command line can't move beyond Eclipse 4.5 (Mars 2).
Comment 2 Manoj N Palat CLA 2018-05-21 06:22:49 EDT
Bulk move out of 4.8

@Jay - retargetting to 4.9 - please modify the target as appropriate
Comment 3 Jay Arthanareeswaran CLA 2018-05-21 06:41:43 EDT
So, the expectation is to not abort compilation but proceed with it when the annotation processor classes are not found? So, the Eclipse compiler found in Maven central doesn't come with those? Perhaps we should include o.e.jdt.compiler.apt also part of the repo? The ECJ.jar that one can download from eclipse downloads page includes this and I think same should be the case for the maven central repo.
Comment 4 Stephan Herrmann CLA 2018-05-24 06:37:18 EDT
(In reply to Sven Efftinge from comment #0)
> It got revealed only now because of the latest jdt.core 3.12.2 release on
> maven central.


This looks like s.o. is consuming that last release of which we did not specifically publish ecj to Maven central. As of now, ppl should use this: https://mvnrepository.com/artifact/org.eclipse.jdt/ecj

Checking the latest from that list (3.13.102) against http://download.eclipse.org/eclipse/downloads/drops4/R-4.7.3a-201803300640/download.php?dropFile=ecj-4.7.3a.jar I see both having the exact same bytes.
Comment 5 Stephan Herrmann CLA 2018-06-05 08:17:55 EDT
@Sven is this still relevant given that a sufficient ecj (recent versions) is available from Maven central?
Comment 6 Christian Dietrich CLA 2018-06-05 08:19:54 EDT
yes and no. since our code is used from maven/gradle and eclipse we added the two other artifactly to our maven path and thus work around this issue
Comment 7 Christian Dietrich CLA 2018-06-05 08:25:55 EDT
=> the main problem is that a user (of jdt core) that does not know that will stumble on that
Comment 8 Stephan Herrmann CLA 2018-06-05 08:41:38 EDT
(In reply to Christian Dietrich from comment #7)
> => the main problem is that a user (of jdt core) that does not know that
> will stumble on that

Not sure I understand. ECJ can be consumed in many ways. When consumed as ecj<version>.jar the problem should not occur, right? Are you thinking of clients who use org.eclipse.jdt.core<version>.jar as their standalone compiler?

Or is this about clients that are tied to that exact version that contains the change mentioned in comment 0, but of which no ecj.jar has been published to Maven? I would think that this affects only version [3.12.0,3.12.2], even an update to 3.12.3 should resolve it, no?
Comment 9 Christian Dietrich CLA 2018-06-05 10:22:48 EDT
yes older versions of jdt.core seemed to have pulled the dependency implicitly when you have have to add them explicitly (additional)
Comment 10 Christian Dietrich CLA 2018-06-05 10:23:15 EDT
=> for us it is no longer a problem since we have all 3 deps explicitly now
Comment 11 Stephan Herrmann CLA 2018-06-05 11:20:37 EDT
(In reply to Christian Dietrich from comment #9)
> yes older versions of jdt.core seemed to have pulled the dependency
> implicitly when you have have to add them explicitly (additional)

Something is still confused: if s.o. wants an ecj batch compiler, they should *not* use the org.eclipse.jdt.core bundle (which by design does not include annotation processing), but ecj.jar, which is complete in this regard and specifically packaged as a standalone compiler.

Why would anyone still use org.eclipse.jdt.core as a batch compiler?
Comment 12 Christian Dietrich CLA 2018-06-05 11:27:50 EDT
Cause jdt.core is there as a dependency since „ever“
Comment 13 Christian Dietrich CLA 2018-06-05 11:30:08 EDT
Is there somewhere a list how Ecj and the 3 eclipse plugins differ from each other
Comment 14 Stephan Herrmann CLA 2018-06-05 12:08:40 EDT
(In reply to Christian Dietrich from comment #13)
> Is there somewhere a list how Ecj and the 3 eclipse plugins differ from each
> other

I'm not aware of a list (other than build scripts ;p), but it should be easily described:
- org.eclipse.jdt.core (6.8MB) is the equinox-based core of the Java IDE
  - has dependencies to some Eclipse platform bundles
- ecj (2.8MB) is the standalone batch compiler, which contains less and more:
  - not contained are codeassist,dom,eval,formatter,model,search
  - additionally contained are impls of JSR 269 and JSR 199:
    - org/eclipse/jdt/internal/compiler/apt/*
    - org/eclipse/jdt/internal/compiler/tool/*
Comment 15 Christian Dietrich CLA 2018-06-05 12:12:00 EDT
the main pointpoint we have is:

- we have code that depends on platform and jdt
- the code is consumed in eclipse and in maven gradle
- if we keep dependencies in eclipse and maven in sync it is easy (we now added the two fragments additionally to maven)
- so we are fine.

- if we use ecj we would stuble over duplicate platform stuff and would be more out of sync of what we do in eclipse and what we do standalone
Comment 16 Stephan Herrmann CLA 2018-08-16 17:53:16 EDT
It seems everybody has a way to get a complete batch compiler by now.
So, is this bug (about continuing when the batch compiler is incomplete) still relevant to anybody?
Comment 17 Eclipse Genie CLA 2020-09-09 10:26:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 18 Eclipse Genie CLA 2023-01-04 15:24:05 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 19 Stephan Herrmann CLA 2023-01-04 17:25:49 EST
Specifically after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/181 it should no longer be possible to pull a recent ecj (in whatever form) lacking org/eclipse/jdt/internal/compiler/apt/*