Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 2.01 KB

README.md

File metadata and controls

43 lines (28 loc) · 2.01 KB

update

Latest update includes eclipse 4.20 release ecj

Java compiler compiles java source files to .class files without any body.

Goal

Generate empty body .class with entire outline (package, method, attributes, exceptions).

Usage

Java compilation does not provide full native code (like graalvm does). For the compilation process it will read only structure but not the body. So for compiliation user won't need for original jar, unless you are bundling dependencies. one can use this project to generate fake jars using which you will save lot of network bandwidth and faster compilation.

download javac-no-body.jar

java -jar javac-no-body.jar file.java

example

compile jdk source and generated rt+javax+sun...jar size: 4.81MB. Original rt.jar size: 60+ MB

Source

Source of this compiler is copied with only one line change to facilitate this project link.

jdt-core source is scrambled across multiple folders for above github repo. For easy access use this link

---- a/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
++++ b/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
<       public boolean ignoreMethodBodies = false;
---
>       public boolean ignoreMethodBodies = true;

beware and bewarned,This project will not be helpful in real world senario.

Its for Pure research and educational purpose.