Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 543184 - CompilerToolJava9Tests fail on Java 11 with: "Only one compiler available expected"
Summary: CompilerToolJava9Tests fail on Java 11 with: "Only one compiler available exp...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.9   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.11 M1   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-05 03:21 EST by Andrey Loskutov CLA
Modified: 2019-01-09 15:57 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2019-01-05 03:21:51 EST
https://download.eclipse.org/eclipse/downloads/drops4/I20190104-1800/testresults/html/org.eclipse.jdt.compiler.tool.tests_ep411I-unit-cen64-gtk3-java11_linux.gtk.x86_64_11.html

All tests from CompilerToolJava9Tests fail to setup because they only can find a single compiler:

Only one compiler available expected:<2> but was:<1> 

junit.framework.AssertionFailedError: Only one compiler available expected:<2> but was:<1> 
at junit.framework.Assert.fail(Assert.java:57) 
at junit.framework.Assert.failNotEquals(Assert.java:329) 
at junit.framework.Assert.assertEquals(Assert.java:78) 
at junit.framework.Assert.assertEquals(Assert.java:234) 
at junit.framework.TestCase.assertEquals(TestCase.java:401) 
at org.eclipse.jdt.compiler.tool.tests.CompilerToolJava9Tests.setUp(CompilerToolJava9Tests.java:96) 

Running test locally in the IDE with JDK 11 works fine (at least on Windows).
Comment 1 Andrey Loskutov CLA 2019-01-05 03:23:54 EST
Tests are broken since 4.9, 4.8 seem to work.
Comment 2 Eclipse Genie CLA 2019-01-05 03:29:22 EST
New Gerrit change created: https://git.eclipse.org/r/134673
Comment 4 Andrey Loskutov CLA 2019-01-07 10:01:55 EST
(In reply to Eclipse Genie from comment #3)
> Gerrit change https://git.eclipse.org/r/134673 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=fd8ce3dd52781df46999576fa403926038d439b7

THis shows us that we miss Eclipse compiler (javac is there): Only one compiler available: [com.sun.tools.javac.api.JavacTool@517704, null] expected:<2> but was:<1> 

So I guess we miss some extra dependency on 11???
Comment 5 Jay Arthanareeswaran CLA 2019-01-07 23:35:36 EST
(In reply to Andrey Loskutov from comment #4)
> So I guess we miss some extra dependency on 11???

I can't figure what that could be. Do you think there is problem in loading the EclipseCompiler? I don't see anything in the logs.
Comment 6 Andrey Loskutov CLA 2019-01-08 09:51:24 EST
(In reply to Jay Arthanareeswaran from comment #5)
> (In reply to Andrey Loskutov from comment #4)
> > So I guess we miss some extra dependency on 11???
> 
> I can't figure what that could be. Do you think there is problem in loading
> the EclipseCompiler? I don't see anything in the logs.

I wonder if this is similar to https://git.eclipse.org/r/#/c/127420/.

I will push a patch in a moment.
Comment 7 Eclipse Genie CLA 2019-01-08 09:52:05 EST
New Gerrit change created: https://git.eclipse.org/r/134781
Comment 9 Eclipse Genie CLA 2019-01-09 03:06:23 EST
New Gerrit change created: https://git.eclipse.org/r/134817
Comment 10 Andrey Loskutov CLA 2019-01-09 03:08:43 EST
(In reply to Eclipse Genie from comment #9)
> New Gerrit change created: https://git.eclipse.org/r/134817

This should finally fix the test. Now we had the EclipseCompiler loaded, but unfortunately the Java compiler doesn't load with the EclipseCompiler class loader on 11, so all we need is just to remove the count check, because the default system JavaCompiler was retrieved by a different method anyway.