Skip to content

Commit

Permalink
[DRAFT] An idea how to restructure JDT core to get proper ecj bundle
Browse files Browse the repository at this point in the history
The org.eclipse.jdt.core.ecj.validation was a "dummy" bundle so far,
used only to validate compilation issues in IDE.

That one should be renamed (org.eclipse.jdt.core.ecj.validation ->
org.eclipse.jdt.core.ecj) and be a proper maven library.

It is actually the ecj compiler library without any dependencies, that
could be consumed by JDT and the rest of the world.

It must be required and re-exported by JDT core.
Unfortunately, there are two split packages:

org.eclipse.jdt.internal.compiler
org.eclipse.jdt.internal.compiler.parser

Not sure what's the best way to deal with it, may be rename those
smaller packages in in jdt.core to avoid split packages issue, they are
internal, so it shouldn't break many clients (but most likely will, like
Xtext), but I haven't tried it and don't know if they use package
protected API.

org.eclipse.jdt.compiler.apt and org.eclipse.jdt.compiler.tool were
fragments of jdt.core, now they would be fragments of
org.eclipse.jdt.core.ecj, but this is problematic.

This breaks tests/clients that required jdt.core before, it seems that
by re-exporting the ecj host API, jdt core doesn't re-export the
fragments of ecj. Not sure why both fragments were fragments before,
might be we could just put them into the ecj bundle directly.

So now rg.eclipse.jdt.compiler.apt and org.eclipse.jdt.compiler.tool are
just bundles. We could merge them together into ecj, I honestly don't
know why they were fragments.

What I did NOT tried is to re-write all the magic scripts that build and
package separated ecj library out of jdt.core.

But this is just an idea how the "real ecj" could look like.

See
- eclipse-jdt#181
- eclipse-platform/eclipse.platform.ua#18
  • Loading branch information
iloveeclipse committed Jun 30, 2022
1 parent 71f50dd commit 22919be
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 26 deletions.
3 changes: 2 additions & 1 deletion org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.junit,
org.eclipse.jdt.core;bundle-version="3.27.0",
org.eclipse.core.resources,
org.eclipse.core.runtime
org.eclipse.core.runtime,
org.eclipse.jdt.compiler.apt;bundle-version="1.4.100"
Export-Package: org.eclipse.jdt.compiler.apt.tests,
org.eclipse.jdt.compiler.apt.tests.annotations,
org.eclipse.jdt.compiler.apt.tests.processors.base,
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.compiler.apt/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Bundle-SymbolicName: org.eclipse.jdt.compiler.apt;singleton:=true
Bundle-Version: 1.4.100.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.jdt.core;bundle-version="[3.27.0,4.0.0)"
Bundle-Localization: compiler_apt_fragment
Export-Package: org.eclipse.jdt.internal.compiler.apt.dispatch;x-friends:="org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.apt.model;x-friends:="org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.apt.util;x-friends:="org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.lookup;x-friends:="org.eclipse.jdt.apt.pluggable.core"
Import-Package: org.eclipse.jdt.internal.compiler.tool;resolution:=optional
Automatic-Module-Name: org.eclipse.jdt.compiler.apt
Require-Bundle: org.eclipse.jdt.core.ecj.validation;bundle-version="1.0.0"
18 changes: 18 additions & 0 deletions org.eclipse.jdt.compiler.tool/.settings/.api_filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jdt.compiler.tool" version="2">
<resource path="META-INF/MANIFEST.MF">
<filter id="924844039">
<message_arguments>
<message_argument value="1.3.150"/>
<message_argument value="1.3.150"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/jdt/internal/compiler/batch/ClasspathJsr199.java" type="org.eclipse.jdt.internal.compiler.batch.ClasspathJsr199">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.batch.ClasspathJsr199"/>
</message_arguments>
</filter>
</resource>
</component>
4 changes: 2 additions & 2 deletions org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bundle-Vendor: %providerName
Bundle-Localization: compiler_tool_fragment
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: META-INF.services,
org.eclipse.jdt.internal.compiler.tool;x-internal:=true
Fragment-Host: org.eclipse.jdt.core;bundle-version="[3.28.100,4.0.0)"
org.eclipse.jdt.internal.compiler.tool;x-friends:="org.eclipse.jdt.compiler.tool.tests"
Bundle-ClassPath: .
Automatic-Module-Name: org.eclipse.jdt.compiler.tool
Require-Bundle: org.eclipse.jdt.core.ecj.validation;bundle-version="1.0.0"
23 changes: 23 additions & 0 deletions org.eclipse.jdt.core.ecj.validation/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ecj
Bundle-SymbolicName: org.eclipse.jdt.core.ecj.validation;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.eclipse.jdt.ecj
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.jdt.core.compiler,
org.eclipse.jdt.core.compiler.batch,
org.eclipse.jdt.internal.compiler,
org.eclipse.jdt.internal.compiler.ast,
org.eclipse.jdt.internal.compiler.batch,
org.eclipse.jdt.internal.compiler.classfmt,
org.eclipse.jdt.internal.compiler.codegen,
org.eclipse.jdt.internal.compiler.env,
org.eclipse.jdt.internal.compiler.flow,
org.eclipse.jdt.internal.compiler.impl,
org.eclipse.jdt.internal.compiler.lookup,
org.eclipse.jdt.internal.compiler.parser,
org.eclipse.jdt.internal.compiler.parser.diagnose,
org.eclipse.jdt.internal.compiler.problem,
org.eclipse.jdt.internal.compiler.util
Bundle-ActivationPolicy: lazy
2 changes: 0 additions & 2 deletions org.eclipse.jdt.core/.classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="antbin" path="antadapter"/>
<classpathentry kind="src" path="batch"/>
<classpathentry kind="src" path="codeassist"/>
<classpathentry kind="src" path="compiler"/>
<classpathentry kind="src" path="dom"/>
<classpathentry kind="src" path="eval"/>
<classpathentry kind="src" path="formatter"/>
Expand Down
130 changes: 130 additions & 0 deletions org.eclipse.jdt.core/.settings/.api_filters
Original file line number Diff line number Diff line change
@@ -1,13 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jdt.core" version="2">
<resource path="META-INF/MANIFEST.MF">
<filter id="923795461">
<message_arguments>
<message_argument value="3.30.100"/>
<message_argument value="3.30.0"/>
</message_arguments>
</filter>
<filter id="924844039">
<message_arguments>
<message_argument value="3.30.100"/>
<message_argument value="3.30.0"/>
</message_arguments>
</filter>
</resource>
<resource path="batch/org/eclipse/jdt/core/compiler/batch/BatchCompiler.java" type="org.eclipse.jdt.core.compiler.batch.BatchCompiler">
<filter id="305324134">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.batch.BatchCompiler"/>
<message_argument value="org.eclipse.jdt.core_3.30.100"/>
</message_arguments>
</filter>
</resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java" type="org.eclipse.jdt.core.compiler.CategorizedProblem">
<filter id="305324134">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.CategorizedProblem"/>
<message_argument value="org.eclipse.jdt.core_3.30.100"/>
</message_arguments>
</filter>
<filter comment="Java 14" id="576725006">
<message_arguments>
<message_argument value="IProblem"/>
<message_argument value="CategorizedProblem"/>
</message_arguments>
</filter>
</resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/CharOperation.java" type="org.eclipse.jdt.core.compiler.CharOperation">
<filter id="305324134">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.CharOperation"/>
<message_argument value="org.eclipse.jdt.core_3.30.100"/>
</message_arguments>
</filter>
</resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/CompilationProgress.java" type="org.eclipse.jdt.core.compiler.CompilationProgress">
<filter id="305324134">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.CompilationProgress"/>
<message_argument value="org.eclipse.jdt.core_3.30.100"/>
</message_arguments>
</filter>
</resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/IProblem.java" type="org.eclipse.jdt.core.compiler.IProblem">
<filter id="305324134">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
<message_argument value="org.eclipse.jdt.core_3.30.100"/>
</message_arguments>
</filter>
</resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/InvalidInputException.java" type="org.eclipse.jdt.core.compiler.InvalidInputException">
<filter id="305324134">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.InvalidInputException"/>
<message_argument value="org.eclipse.jdt.core_3.30.100"/>
</message_arguments>
</filter>
</resource>
<resource path="dom/org/eclipse/jdt/core/dom/AbstractTagElement.java" type="org.eclipse.jdt.core.dom.AbstractTagElement">
<filter id="576725006">
<message_arguments>
Expand Down Expand Up @@ -264,4 +324,74 @@
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java" type="org.eclipse.jdt.internal.compiler.DocumentElementParser">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.DocumentElementParser"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/ExtraFlags.java" type="org.eclipse.jdt.internal.compiler.ExtraFlags">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.ExtraFlags"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java" type="org.eclipse.jdt.internal.compiler.IDocumentElementRequestor">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.IDocumentElementRequestor"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java" type="org.eclipse.jdt.internal.compiler.ISourceElementRequestor">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.ISourceElementRequestor"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java" type="org.eclipse.jdt.internal.compiler.SourceElementNotifier">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.SourceElementNotifier"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/SourceElementParser.java" type="org.eclipse.jdt.internal.compiler.SourceElementParser">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.SourceElementParser"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java" type="org.eclipse.jdt.internal.compiler.SourceElementRequestorAdapter">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.SourceElementRequestorAdapter"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/SourceJavadocParser.java" type="org.eclipse.jdt.internal.compiler.SourceJavadocParser">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.SourceJavadocParser"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java" type="org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java" type="org.eclipse.jdt.internal.compiler.parser.TypeConverter">
<filter id="1110441988">
<message_arguments>
<message_argument value="org.eclipse.jdt.internal.compiler.parser.TypeConverter"/>
</message_arguments>
</filter>
</resource>
</component>
26 changes: 6 additions & 20 deletions org.eclipse.jdt.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core,
org.eclipse.jdt.core.compiler,
org.eclipse.jdt.core.compiler.batch,
org.eclipse.jdt.core.dom,
org.eclipse.jdt.core.dom.rewrite,
org.eclipse.jdt.core.eval,
Expand All @@ -23,24 +22,8 @@ Export-Package: org.eclipse.jdt.core,
org.eclipse.jdt.internal.codeassist.complete;x-internal:=true,
org.eclipse.jdt.internal.codeassist.impl;x-internal:=true,
org.eclipse.jdt.internal.codeassist.select;x-internal:=true,
org.eclipse.jdt.internal.compiler;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.ast;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.batch;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.classfmt;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core,org.eclipse.pde.api.tools",
org.eclipse.jdt.internal.compiler.codegen;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core,org.eclipse.pde.api.tools",
org.eclipse.jdt.internal.compiler.env;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.flow;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.impl;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core,org.eclipse.jdt.debug",
org.eclipse.jdt.internal.compiler.lookup;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.parser;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.parser.diagnose;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.problem;x-friends:="org.eclipse.jdt.compiler.tool,org.eclipse.jdt.apt.pluggable.core",
org.eclipse.jdt.internal.compiler.util;
x-friends:="org.eclipse.jdt.apt.pluggable.core,
org.eclipse.jdt.compiler.tool,
org.eclipse.pde.api.tools,
org.eclipse.jdt.apt.core,
org.eclipse.jdt.debug",
org.eclipse.jdt.internal.compiler,
org.eclipse.jdt.internal.compiler.parser,
org.eclipse.jdt.internal.core;x-friends:="org.eclipse.jdt.apt.pluggable.core,org.eclipse.pde.api.tools,org.eclipse.jdt.launching",
org.eclipse.jdt.internal.core.builder;x-friends:="org.eclipse.jdt.apt.pluggable.core,org.eclipse.pde.api.tools",
org.eclipse.jdt.internal.core.dom;x-internal:=true,
Expand All @@ -64,7 +47,10 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.17.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.13.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.7.0,2.0.0)",
org.eclipse.text;bundle-version="[3.6.0,4.0.0)",
org.eclipse.team.core;bundle-version="[3.1.0,4.0.0)";resolution:=optional
org.eclipse.team.core;bundle-version="[3.1.0,4.0.0)";resolution:=optional,
org.eclipse.jdt.core.ecj.validation;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.jdt.compiler.apt;bundle-version="1.4.100";visibility:=reexport,
org.eclipse.jdt.compiler.tool;bundle-version="1.3.150";visibility:=reexport
Bundle-RequiredExecutionEnvironment: JavaSE-11
Eclipse-ExtensibleAPI: true
Bundle-ActivationPolicy: lazy
Expand Down

0 comments on commit 22919be

Please sign in to comment.