Questions tagged [ecj]

Eclipse has implemented its own compiler called as Eclipse Compiler for Java (ECJ). This tag is for questions relating to the behaviour of that compiler.

ECJ is different from javac, the compiler that is shipped with Sun JDK. One notable difference is that the Eclipse compiler lets you run code that didn't actually properly compile. If the block of code with the error is never ran, your program will run fine. Otherwise, it will throw an exception indicating that you tried to run code that doesn't compile.

Another difference is that the Eclipse compiler allows for incremental builds from within the Eclipse IDE, that is, all code is compiled as soon as you finish typing.

The fact that Eclipse comes with its own compiler is also apparent because you can write, compile, and run Java code in Eclipse without even installing the Java SDK.

Further reading: What is the difference between javac and the Eclipse compiler? (from which the above text was taken).

67 questions
2
votes
1 answer
2
votes
1 answer

Eclipse Java compiler infers the wrong generic type?

I wonder if this is a bug in ECJ or a valid interpretation of the JLS. import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.function.Supplier; public class GenericsTest { public void testInference() { …
Dan Berindei
  • 7,054
  • 3
  • 41
  • 48
2
votes
1 answer

Java code fails in Intellij but not in eclipse, with ambiguous method error

I have the below Java class (with nested classes/interfaces). When running the main method from within Eclipse (Version: 2019-09 R (4.13.0)) I get the following output: java.version: 1.8.0_241 PageA.m3() called This is the command line used by…
etxalpo
  • 1,146
  • 1
  • 14
  • 25
2
votes
1 answer

Is Eclipse's ecj compiler extensible?

I am interested in modifying Java syntax and some implicit paradigms. Since I develop with Eclipse which provides it's own compiler, which can also be used standalone, I was wondering if it wasn't possible to extend ecj to respect additional grammar…
TreffnonX
  • 2,924
  • 15
  • 23
2
votes
0 answers

How does eclipse generate .class files with compilation errors?

I have a dynamic web project in eclipse, and to build we usually right click on the project > export as > war file. We then deploy the war file to a websphere server. The project has unresolved dependencies (Which are resolved later when we deploy…
shelby
  • 21
  • 1
  • 1
2
votes
1 answer

Gradle: How to compile Java by eclipse ECJ (JDT core) by running Gradle 4.1 task

I have a project that can be build well by eclipse (ECJ) But Oracle javac can't build it (some reasons like in link: the different of ecj and javac). I would like moving from eclipse to build by Gradle, in order to Jenkins can run Gradle script.…
2
votes
2 answers

Why javac requires an interfaces of referenced classes when ECJ does not?

When compiling a Client, which uses some implementation of interface I (e.g. O), the classfile for I must also be present on the classpath. What is strange, this is only a case for javac, as Eclipse compiler (ECJ) does not require I for…
pwes
  • 2,040
  • 21
  • 30
2
votes
1 answer

Invalid method reference / ambiguous reference (javac / ecj behaviour difference)

The following code compiles and runs correctly when using the Eclipse Compiler for Java. package org.sandbox; public final class ExceptionUtils { private ExceptionUtils(){} @FunctionalInterface public interface Runnable { …
jr.
  • 1,699
  • 14
  • 31
2
votes
2 answers

Island Model in ECJ

In Genetic Programming (GP), when island model is used, does it mean that it will split the population size between islands? For example, if in parameters file we have pop.subpop.0.size = 4000 and we have 4 islands, does it mean that each island…
ashkanent
  • 205
  • 2
  • 10
1
vote
0 answers

Gradle annotation processor with ECJ compiler produces "Unable to get public no-arg constructor" error

I'm trying to compile a gradle project with the ECJ compiler. I have an annotation processor in one of the projects, that the other projects depend on. When ECJ attempts to run the annotation processor, it produces this error: 1. ERROR in…
user1428945
  • 339
  • 1
  • 13
1
vote
0 answers

Eclipse compiler and OpenJDK javac behave differently when assigning generic types with wildcards

The following code compiles and runs just fine with Eclipse 2022-12 (4.26.0). public static void main(String[] args) { List> list = Arrays.asList(Arrays.asList("test")); System.out.println(test(list)); } public static T…
stonar96
  • 1,359
  • 2
  • 11
  • 39
1
vote
1 answer

Building maven projects with JDT Core compiler

I am a new Maven user. I am aware that the default compiler which Maven uses to build its projects with is Javac. However, I want to use JDT Core compiler in order to build. I tried adding this plugin into my plugins in my root pom, but it doesn't…
eaRobust
  • 87
  • 6
1
vote
0 answers

Eclipse java ASTParser ArrayIndexOutOfBoundsException error

i'm trying to make AST of java code in eclipse. i'm following example of https://help.eclipse.org/2019-12/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2Fdom%2FASTParser.html As Example of the link, i…
1
vote
0 answers

ECJ fails with IllegalArgumentException processing log4j annotations

I'm using log4j 2.11.1 in my project and created some custom appenders and configuration factories using the @Plugin annotation. This compiles just fine without errors both in Eclipse 4.9 and with IntelliJ. However, running the Eclipse batch…
1
vote
0 answers

How do I resolve No Java compiler available for configuration options compilerClassName: [null] and compiler: [null]

I have a starter spring boot Hello World program, which is throwing the following error: No Java compiler available for configuration options compilerClassName: [null] and compiler: [null] I issue is ONLY in Mac and not in windows PC. On my Mac I…
shortduck
  • 1,437
  • 1
  • 8
  • 13