Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support of older Java releases in ecj #2536

Closed
iloveeclipse opened this issue Jun 7, 2024 Discussed in #820 · 8 comments · Fixed by #2551
Closed

Drop support of older Java releases in ecj #2536

iloveeclipse opened this issue Jun 7, 2024 Discussed in #820 · 8 comments · Fixed by #2551
Assignees
Labels
compiler Eclipse Java Compiler (ecj) related issues enhancement New feature or request
Milestone

Comments

@iloveeclipse
Copy link
Member

Discussed in #820

Originally posted by iloveeclipse March 9, 2023
Stephan asked good question, I'm not sure we've discussed that before.

The question is:

  • Did we discuss dropping support for some ancient Java versions? What's the status there?

and my take on this is: if we can make our life easier, we should follow what javac does, and it does what was proposed in JEP-182: with each Java LTS release they seem to drop support for one of previous releases.

See

Current state in Java 17 (still same in 19):

/usr/lib/jvm/java-17/bin/javac --help | grep release
        Enable preview language features. To be used in conjunction with either -source or --release.
  --release <release>
        Compile for the specified Java SE release. Supported releases: 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
  --source <release>, -source <release>
        Provide source compatibility with the specified Java SE release. Supported releases: 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
  --target <release>, -target <release>
        Generate class files suitable for the specified Java SE release. Supported releases: 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17

for Java 21 we have

  --release <release>
        Compile for the specified Java SE release.
        Supported releases: 
            8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21
  -s <directory>               Specify where to place generated source files
  --source <release>, -source <release>
        Provide source compatibility with the specified Java SE release.
        Supported releases: 
            8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21
  --source-path <path>, -sourcepath <path>
        Specify where to find input source files
  --system <jdk>|none          Override location of system modules
  --target <release>, -target <release>
        Generate class files suitable for the specified Java SE release.
        Supported releases: 
            8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21

The proposal is for 4.33 to drop support for all Java releases older Java 8.

I plan to start working on this next week.

@iloveeclipse iloveeclipse added enhancement New feature or request compiler Eclipse Java Compiler (ecj) related issues labels Jun 7, 2024
@mpalat
Copy link
Contributor

mpalat commented Jun 11, 2024

@iloveeclipse - How about we take an approach something similar to deprecation in apis.- in a staggered manner - instead of throwing an error in 4.33, we issue a warning in 4.33 and then an error in 4.34?

@iloveeclipse
Copy link
Member Author

The reason to start this initiative was reducing the effort for maintenance & focus on quality of new Java features.
Adding warnings will just postpone unavoidable for one release but not help with any of the goals.
Users will simply ignore the warning for now and complain on next release.
So I'm for a "clean" error solution.
Whoever needs to compile to an ancient Java can use any of previously released ecj/SDK versions.

iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 11, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 13, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 13, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 13, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 14, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 14, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 17, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 17, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 17, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 17, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.pde.ui that referenced this issue Jun 18, 2024
Basically moves tests that used various old 1.x JDK compiler settings to
use 1.8 target (only supported 1.x Java compiler target in the future).

See eclipse-jdt/eclipse.jdt.core#2536
@jarthana
Copy link
Member

Are there issues in jdt.ui and jdt.debug that may be required for this? I don't yet know what we require to do there, but for starter, we will need to remove the compliance from the UI. Might be a good idea to start the discussions around the UI too.

iloveeclipse added a commit to iloveeclipse/eclipse.pde.ui that referenced this issue Jun 18, 2024
Basically moves tests that used various old 1.x JDK compiler settings to
use 1.8 target (only supported 1.x Java compiler target in the future).

See eclipse-jdt/eclipse.jdt.core#2536
@iloveeclipse
Copy link
Member Author

Are there issues in jdt.ui and jdt.debug that may be required for this?

Code wise not yet (as I didn't removed JavaCore constants for old Java versions), but I guess there will be some.

we will need to remove the compliance from the UI.

This is for sure pending, we will need to change the "target" properties/preference pages in JDT UI and also "available execution environments" for PDE/Debug UI.

I will check that but of course would be nice if someone else could take it over while I'm looking into JDT test fixes.

I've just pushed eclipse-pde/eclipse.pde#1309 for PDE tests that moves their compilation level from 1.4/1.5 to 1.8. (most of the PDE tests were written at IBM times with Java 1.5 considered "modern" environment :-) )

Regarding JDT tests: as we can see, fails are now down to ~800 from initial ~2.500. I intentionally do not disable tests yet to see how far we can go preserving tests also written for old targets because many of them aren't JLS target specific.

@jarthana
Copy link
Member

jarthana commented Jun 18, 2024

I will check that but of course would be nice if someone else could take it over while I'm looking into JDT test fixes.

Sorry, I didn't mean to check if you were going to work on it. I am sure (and hope) we have enough committers in UI to take care of that. I raised eclipse-jdt/eclipse.jdt.ui#1465 to track that.

iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 18, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Jun 18, 2024
iloveeclipse added a commit to iloveeclipse/eclipse.pde.ui that referenced this issue Jun 18, 2024
Basically moves tests that used various old 1.x JDK compiler settings to
use 1.8 target (only supported 1.x Java compiler target in the future).

See eclipse-jdt/eclipse.jdt.core#2536
iloveeclipse added a commit to iloveeclipse/eclipse.pde.ui that referenced this issue Jun 18, 2024
Basically moves tests that used various old 1.x JDK compiler settings to
use 1.8 target (only supported 1.x Java compiler target in the future).

See eclipse-jdt/eclipse.jdt.core#2536
@iloveeclipse
Copy link
Member Author

I raised eclipse-jdt/eclipse.jdt.ui#1465 to track that.

I've created another ticket for debugger, as most of configuration pages are provided by debugger: eclipse-jdt/eclipse.jdt.debug#451

iloveeclipse added a commit to eclipse-pde/eclipse.pde that referenced this issue Jun 18, 2024
Basically moves tests that used various old 1.x JDK compiler settings to
use 1.8 target (only supported 1.x Java compiler target in the future).

See eclipse-jdt/eclipse.jdt.core#2536
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.ui that referenced this issue Jul 26, 2024
- AddImportTest
- BindingsNameTest
- JavaElementPropertyTesterTest
- OverrideTest
- GenerateHashCodeEqualsTest
- AdvancedQuickAssistTest
- AdvancedQuickAssistTest1d7
- AssistQuickFixTest1d8
- CleanUpStressTest
- CleanUpTest1d5
- CleanUpTest1d6
- JavadocQuickFixTest
- ModifierCorrectionsQuickFixTest1d7
- QuickFixEnablementTest
- TypeParameterMismatchTest

See eclipse-jdt/eclipse.jdt.core#2536
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.ui that referenced this issue Jul 26, 2024
- AddImportTest
- BindingsNameTest
- JavaElementPropertyTesterTest
- OverrideTest
- GenerateHashCodeEqualsTest
- AdvancedQuickAssistTest
- AdvancedQuickAssistTest1d7
- AssistQuickFixTest1d8
- CleanUpStressTest
- CleanUpTest1d5
- CleanUpTest1d6
- JavadocQuickFixTest
- ModifierCorrectionsQuickFixTest1d7
- QuickFixEnablementTest
- TypeParameterMismatchTest
- InlineConstantTests
- InlineTempTests1d7

Muted test failure in InlineTempTests.test31() and created
https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1552 for that, it
is is a bug in current implementation.

See eclipse-jdt/eclipse.jdt.core#2536
iloveeclipse added a commit to eclipse-jdt/eclipse.jdt.ui that referenced this issue Jul 26, 2024
- AddImportTest
- BindingsNameTest
- JavaElementPropertyTesterTest
- OverrideTest
- GenerateHashCodeEqualsTest
- AdvancedQuickAssistTest
- AdvancedQuickAssistTest1d7
- AssistQuickFixTest1d8
- CleanUpStressTest
- CleanUpTest1d5
- CleanUpTest1d6
- JavadocQuickFixTest
- ModifierCorrectionsQuickFixTest1d7
- QuickFixEnablementTest
- TypeParameterMismatchTest
- InlineConstantTests
- InlineTempTests1d7

Muted test failure in InlineTempTests.test31() and created
https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1552 for that, it
is is a bug in current implementation.

See eclipse-jdt/eclipse.jdt.core#2536
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.ui that referenced this issue Jul 26, 2024
Follow up from
eclipse-jdt/eclipse.jdt.core#2536.
After switching to minimal 1.8 project compliance in JDT, test
`PluginsNotLoadedTest.pluginsNotLoaded` fails complaining about loaded
org.eclipse.jdt.junit bundle.

See
https://download.eclipse.org/eclipse/downloads/drops4/I20240725-1800/testresults/html/org.eclipse.jdt.text.tests_ep433I-unit-cen64-gtk3-java22_linux.gtk.x86_64_22.html

Interestingly, it doesn't fail on both Mac platforms, but see below.

While debugging (break point at
`org.eclipse.jdt.internal.junit.ui.JUnitPlugin.start(BundleContext)`)
one can see that the class is loaded at
`org.eclipse.jdt.text.tests.MarkOccurrenceTest.markMethodOccurrences()`
test, which, surprisingly ... opens Java editor on
`junit.framework.TestCase` class and that one tries to draw warning
marker annotations that in turn activate warning marker quick fix
processor `org.eclipse.jdt.internal.junit.ui.JUnitQuickFixProcessor`
that triggers JUnit loading.

Not clear why this doesn't work on Mac, probably drawing there is a bit
different and so no JUnit bundle is loaded.

To solve that, let run PluginsNotLoadedTest as first test in the test
suite (not sure why it wasn't done before).

Also while debugging the test I saw that the JUnit bundle is not loaded
if the welcome page was open, which was hiding opened Java editor and
that in turn didn't activated all of Java editor functionality. So let
close welcome page, which should have been done anyway for any UI test.
iloveeclipse added a commit to eclipse-jdt/eclipse.jdt.ui that referenced this issue Jul 26, 2024
Follow up from
eclipse-jdt/eclipse.jdt.core#2536.
After switching to minimal 1.8 project compliance in JDT, test
`PluginsNotLoadedTest.pluginsNotLoaded` fails complaining about loaded
org.eclipse.jdt.junit bundle.

See
https://download.eclipse.org/eclipse/downloads/drops4/I20240725-1800/testresults/html/org.eclipse.jdt.text.tests_ep433I-unit-cen64-gtk3-java22_linux.gtk.x86_64_22.html

Interestingly, it doesn't fail on both Mac platforms, but see below.

While debugging (break point at
`org.eclipse.jdt.internal.junit.ui.JUnitPlugin.start(BundleContext)`)
one can see that the class is loaded at
`org.eclipse.jdt.text.tests.MarkOccurrenceTest.markMethodOccurrences()`
test, which, surprisingly ... opens Java editor on
`junit.framework.TestCase` class and that one tries to draw warning
marker annotations that in turn activate warning marker quick fix
processor `org.eclipse.jdt.internal.junit.ui.JUnitQuickFixProcessor`
that triggers JUnit loading.

Not clear why this doesn't work on Mac, probably drawing there is a bit
different and so no JUnit bundle is loaded.

To solve that, let run PluginsNotLoadedTest as first test in the test
suite (not sure why it wasn't done before).

Also while debugging the test I saw that the JUnit bundle is not loaded
if the welcome page was open, which was hiding opened Java editor and
that in turn didn't activated all of Java editor functionality. So let
close welcome page, which should have been done anyway for any UI test.
iloveeclipse added a commit to iloveeclipse/eclipse.jdt.ui that referenced this issue Jul 26, 2024
iloveeclipse added a commit to eclipse-jdt/eclipse.jdt.ui that referenced this issue Jul 27, 2024
fedejeanne pushed a commit to fedejeanne/eclipse.pde that referenced this issue Jul 31, 2024
Basically moves tests that used various old 1.x JDK compiler settings to
use 1.8 target (only supported 1.x Java compiler target in the future).

See eclipse-jdt/eclipse.jdt.core#2536
@testforstephen
Copy link
Contributor

Sorry to raise a concern late for this issue. Dropping support for older Java versions in ECJ is fine when it is used as a standalone compiler. However, this may cause confusion when ECJ is integrated into IDEs such as Eclipse. Since Eclipse integrates the latest ECJ by default, it is not possible to specify an older ECJ version with the latest JDT. As a result, newer versions of Eclipse will no longer support Java 1.7 and lower, potentially confusing users working on legacy projects.

@iloveeclipse
Copy link
Member Author

newer versions of Eclipse will no longer support Java 1.7 and lower, potentially confusing users working on legacy projects.

Not sure where confusion is coming from, as ecj is a part of JDT core / IDE, it was clear that dropping legacy Java versions support in ecj means exact same for the IDE.

  • Users working on legacy projects could continue use legacy Eclipse releases as long as they will run on legacy Java versions and legacy operating systems. No one forces anyone to update Eclipse, Java or operating system.
  • Users who want support for legacy Java versions in latest ecj/IDE should contribute to the project.
  • With the current project resources we don't have the choice.

iloveeclipse added a commit to iloveeclipse/eclipse.jdt.core that referenced this issue Aug 7, 2024
Both options are still present in compiler/core code, but shouldn't be
set to any other value as "error". For now we will ignore any provided
values and use "error" by default.

See eclipse-jdt#2536
iloveeclipse added a commit that referenced this issue Aug 7, 2024
Both options are still present in compiler/core code, but shouldn't be
set to any other value as "error". For now we will ignore any provided
values and use "error" by default.

See #2536
trancexpress pushed a commit to trancexpress/www.eclipse.org-eclipse that referenced this issue Aug 26, 2024
Added an entry for JDT, mentioning the removal of source, target and
release Java 7 and below.

See the respective JDT issue:
eclipse-jdt/eclipse.jdt.core#2536
trancexpress added a commit to trancexpress/www.eclipse.org-eclipse that referenced this issue Aug 26, 2024
Added an entry for JDT, mentioning the removal of source, target and
release Java 7 and below.

See the respective JDT issue:
eclipse-jdt/eclipse.jdt.core#2536
Signed-off-by: Simeon Andreev <[email protected]>
trancexpress added a commit to trancexpress/www.eclipse.org-eclipse that referenced this issue Aug 26, 2024
Added an entry for JDT, mentioning the removal of source, target and
release Java 7 and below.

See the respective JDT issue:
eclipse-jdt/eclipse.jdt.core#2536
Signed-off-by: Simeon Andreev <[email protected]>
trancexpress added a commit to trancexpress/www.eclipse.org-eclipse that referenced this issue Aug 26, 2024
Added an entry for JDT, mentioning the removal of source, target and
release Java 7 and below.

See the respective JDT issue:
eclipse-jdt/eclipse.jdt.core#2536
Signed-off-by: Simeon Andreev <[email protected]>
iloveeclipse pushed a commit to eclipse-platform/www.eclipse.org-eclipse that referenced this issue Aug 26, 2024
Added an entry for JDT, mentioning the removal of source, target and
release Java 7 and below.

See the respective JDT issue:
eclipse-jdt/eclipse.jdt.core#2536
Signed-off-by: Simeon Andreev <[email protected]>
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
- `List<String> getAllJavaSourceVersionsSupportedByCompiler()` - all
Java versions that could be used for Java projects inside Eclipse. The
difference to existing `getAllVersions()` API is that later one knows
almost all Java versions ever released and might be used not only in JDT
core but also in debugger/PDE area.
- `boolean isJavaSourceVersionSupportedByCompiler(String version)` -
differs from existing `isSupportedJavaVersion()` in the same way as
explained above
- `String getFirstJavaSourceVersionSupportedByCompiler()` - similar to
existing `latestSupportedJavaVersion()` and should return minimal
"default" version supported by JDT.

API above will be used in JDT UI, Debug (PR's are following), and (most
likely) PDE.

**Internal** API added in batch compiler `CompilerOptions`:
- `getFirstSupportedJavaVersion()`
- `getFirstSupportedJdkLevel()`

See eclipse-jdt#2536
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
Added one suite to rule all: RunAllJdtModelTestsTracing, to avoid
(random) pattern-matching based test execution order in maven build.
Additionally run all tests with TracingSuite (will log every test
executed & create dumps if test hangs).

See eclipse-jdt#2536
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
The main goal is to be more verbose on any unexpected error, do not hide
them, have clean and consistent environment between testsuites
executions and between local/Jenkins executions.

Many testsuites are written in a different style and do some assertions
related to the way how testsuite shares common setup data between
different tests extending the testsuite. Unfortunately the logic is
complicated to understand and so many testsuites leave environment in a
different state as before (e.g. leraking created projects, settings like
classpath variables etc). As a short term solution
CleanupAfterSuiteTests can be added after such "messy" test suites to
cleanup environment for the following testsuites.

Extracted / added common code for cleanup:

- org.eclipse.jdt.core.tests.util.Util.cleanupWorkspace(String)
- org.eclipse.jdt.core.tests.util.Util.cleanupClassPathVariablesAndContainers()

Added resource settings in bug.test.b534624 for
ModuleBuilderTests.testBug534624a, otherwise the test fails with
unrelated warning about missing encoding.

Changes setup of CompletionTests, CompletionTests2 and parent class to
avoid errors that happen if both testsuites run together.

See eclipse-jdt#2536
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
The jar path was defined as classpath variable but was never provided.
In order to have a clean environment state with all variables properly
defined (and so allow automatic checks for the invalid variables), added
jclFull1.8src.zip as a copy of jclMin1.8src.zip.

Note: it was not possible to find out how jclFull1.8src was originally
constructed, so here we simply copy jclMin1.8src.

See eclipse-jdt#2536
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
This variable is defined as "src" and seem to be not always available

See eclipse-jdt#2536
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Eclipse Java Compiler (ecj) related issues enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants