eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
161 stars 129 forks source link

1100 formatter tests failed with exact same problem on Windows/Java 11 I20220425-1800 #42

Closed iloveeclipse closed 2 years ago

iloveeclipse commented 2 years ago

~1100 formatter tests failed with exact same problem on Windows/Java 11 build only:

Failure seem to be a problem with restoring workspace preferences after the test. I don't think it is Windows related, it looks like some random error.

--------- Difference is ----------
expected:<... compliance level: 1[.8\n
- JDK source level: 1.8\n
- JDK target level: 1.8]\n
- verbose : OFF\...> but was:<... compliance level: 1[1\n
- JDK source level: 11\n
- JDK target level: 11]\n
- verbose : OFF\...>
at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertStringEquals(TestCase.java:266)
at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertEquals(TestCase.java:242)
at org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.tearDown(AbstractJavaModelTests.java:3909)

Note: the code checks that JavaCore.getOptions() equals to expected defaults from org.eclipse.jdt.core.JavaCore.getDefaultOptions().

I see no immediate reason why this particular test would mess up options, nor recent related changes.

However I also do not see any code that would "fix" broken options to defaults. I will add a change so that options are properly reset to avoid following tests might be affected by some previous failure.

stephan-herrmann commented 2 years ago

@iloveeclipse have you seen that this issue has a long history?

After your change, is the original check still performed (didn't check the code)?

iloveeclipse commented 2 years ago

@stephan-herrmann : sure, the change only prevents the problem to show 1000 times. Thanks for pointers, I was not aware the issue is old one, haven't seen such high number of fails yet.