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

Java9ElementTests#test530024_001 and MementoTests#testAnnotationPath9 failing in builds #736

Closed
jarthana opened this issue Feb 14, 2023 · 2 comments

Comments

@jarthana
Copy link
Member

The test is failing with this trace only on Windows machine. But this is not reproducible on my Windows 11 machine.

----------- Expected ------------
=Java9Elements/C:/PROGRA1/ECLIPS1/jdk-17.0.5.8-hotspot/jmods/java.base.jmod=/module=/true=/<'java.base ------------ but was ------------ =Java9Elements/C:\/PROGRA\~1\/ECLIPS\~1\/jdk-17.0.5.8-hotspot\/jmods\/java.base.jmod=/module=/true=/<'java.base
--------- Difference is ----------
expected:<...9Elements/C:/PROGRA[~1/ECLIPS]~1/jdk-17.0.5.8-hot...> but was:<...9Elements/C:/PROGRA[~1/ECLIPS]~1/jdk-17.0.5.8-hot...>
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.Java9ElementTests.test530024_001(Java9ElementTests.java:1635)

I see similar failures in MementoTests#testAnnotationPath9() also. The difference is the extra escaping char \ before '~'.

Interestingly testAnnotationPath9 was fixed via https://bugs.eclipse.org/bugs/show_bug.cgi?id=566242

@iloveeclipse
Copy link
Member

iloveeclipse commented Feb 19, 2023

The root cause of the new fail is that the JRE path contains now ~ character which is unfortunately auto-escaped in org.eclipse.jdt.internal.core.JavaElement.escapeMementoName(StringBuffer, String) ( ~ matches org.eclipse.jdt.internal.core.JavaElement.JEM_METHOD).

The JRE path is part of the IModuleDescription memento.

I'm not sure what that memento escaping is supposed to do in presence of valid path characters for Java elements that contain real path as a part of the memento name. There are few characters used by JavaElement.JEM_ constants that may be used in paths - all they will be escaped.

See also related discussion on https://bugs.eclipse.org/bugs/show_bug.cgi?id=430136

@jarthana
Copy link
Member Author

I can make the test fail locally by moving my JDK to a path with ~ in it. I thought I should be able to replicate this failure in the Java Element view, but can't. Will take a closer look at to find what's going on.

jukzi pushed a commit to jukzi/eclipse.jdt.core that referenced this issue Jul 19, 2023
use same encoding in test assumption as in implementation.
eclipse-jdt#736
@jukzi jukzi closed this as completed in 6858cfe Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants