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
1
vote
1 answer

Create ecj.jar file in Eclipse

I made some changes to elipse.jdt.core plugin in order to support a language (MaxJ) similar to Java. Changes that I made can be found here: https://github.com/maxeler/eclipse.jdt.core/tree/MAXJ_4_4_maintenance Release of my plugin can be found here:…
Ivan Kulezic
  • 440
  • 4
  • 15
1
vote
1 answer

Java 8 and Stream: type is not guessed correctly using Eclipse Compiler (ECJ)

I have this code: Arrays.asList(1L, 2L, 3L, 10L, 20L, 30L, 100L) .stream() .map(Bytes::fromMegaBytes) // Function .map(FileUtils::generateTempFileRunEx) // Function .flatMap(path ->…
NoDataFound
  • 11,381
  • 33
  • 59
1
vote
0 answers

Relationship between Eclipse default JRE, project compliance and compiler used

I couldn't understand for some time why my Maven project wasn't building in Eclipse and presented me with "Bad version number in .class file" errors. I checked all my dependencies and ensured they were built for Java 6 or lower (using this handy…
Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
1
vote
1 answer

Is it possible to dynamically generate Java code strings from Xtend strings?

In Java, it's possible to compile and load classes at runtime from source code contained in strings (e.g. using javax.tools.JavaCompiler, EclipseCompiler, or Janino). This process can be entirely in-memory, without writing any temporary files. The…
Jim Pivarski
  • 5,568
  • 2
  • 35
  • 47
0
votes
1 answer

Does javac generate inaccurate line numbers compared to ecj (for this particular case)?

I use the following class which has this specificity in the equals() method that the return keyword and its expressions are split into several lines (return keyword is on its own line). package jd.core.test; import java.util.Locale; import…
Sybuser
  • 735
  • 10
  • 27
0
votes
1 answer

AspectJ (ajc) with Modules

I am using AspectJ 1.9.7 and I am trying to compile a modular application with ajc. Let's suppose I have a single module called test and the following tree: . └── test ├── aspectj │   ├── Main.java │   └── TestAspect.aj └──…
Marco Luzzara
  • 5,540
  • 3
  • 16
  • 42
0
votes
0 answers

how to get ast tree from elements in eclipse ecj like JavacTrees.getTree(element) in javac?

I write a custom annotation Processor, I hope get ast tree in process method in eclipse ecj compiler: private JavacProcessingEnvironment env; private BaseProcessingEnvImpl eclipseEnv; @Override public boolean process(Set
Guo
  • 1,761
  • 2
  • 22
  • 45
0
votes
1 answer

How get the output from one maven plugin into another?

I currently run the Eclipse Java compiler (ECJ) plugin in Maven in order to scan my code for errors and warnings. I want to design a plugin for Maven that is able to take in all the errors and warnings found by the ECJ in order to parse through…
0
votes
0 answers

Error - cannot infer type-variable(s) K,V - OpenJDK 1.8 vs ECJ 1.8 difference with lambdas?

I have following code: Type a; List, LocalDate>> list = new LinkedList<>(); a.getListB().stream().forEach((TypeB b) -> { list.add(new Pair<>(b::setDate, b.getDate())); }); And eclipse allows reduction to (no…
JIV
  • 813
  • 2
  • 12
  • 30
0
votes
3 answers

Java 14 text block leading \r\n inserted when used in Eclipse 4.15.0

I am in the process of learning how to cope with java 14 (preview) text blocks. When using following text block in a Junit test I run across the following unexpected feature (simplified code example, in the real test I use an HTML…
PaulN
  • 63
  • 2
  • 10
0
votes
0 answers

Rebuild android.jar with appcompat library on device in Termux

This project https://github.com/BuildAPKs/buildAPKs builds APKs on device in Termux in Android. Frequent errors are related to appcompat when compiling without artifacts, i.e., Error retrieving parent for item: No resource found that matches the…
0
votes
0 answers

Ant Classloader task and java 13

I'm upgrading our app from Java 8 to Java 13. We use Eclipse ECJ in our build process. To make it work, our ant script has:
CasaDelGato
  • 603
  • 7
  • 17
0
votes
1 answer

What are the reference infos when using Eclipse Batch Compiler

When reading through the Eclipse Batch Compiler Documentation for Java, I came accross the flag -referenceInfo whichs description is as follows: Compute reference info. This is useful only if connected to the builder. The reference infos are…
AndiCover
  • 1,724
  • 3
  • 17
  • 38
0
votes
2 answers

Fatal error compiling: Failed to run the ecj compiler: Unrecognized option : --module-version

Trying to run the following combination: Maven (3.6.1) OpenJDK 11 With module-info.java Fails with the following error message: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on…
jpmsnewbie
  • 115
  • 7
0
votes
0 answers

Strange java.lang.ClassNotFoundException when compiling drools rules (v5.0.1) on Java 8 on Rule Name as class

Trying to get drools to run java8 jvm (upgraded from Java6). However, compilation has failed and the goal pushed further. Did a couple of things that helped: Ecj compiler: updated to 'org.eclipse.jdt.core.compiler:ecj:4.5.1' Mvel: Using updated…
Vikas
  • 4,184
  • 2
  • 12
  • 9