Bug 545747 - [search] Missing references with SLF4J on classpath and Java 11
Summary: [search] Missing references with SLF4J on classpath and Java 11
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.11   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-25 09:37 EDT by Olivier Cailloux CLA
Modified: 2022-07-28 01:55 EDT (History)
1 user (show)

See Also:


Attachments
Example pom.xml to reproduce the bug (789 bytes, text/xml)
2019-03-25 09:42 EDT, Olivier Cailloux CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Cailloux CLA 2019-03-25 09:37:45 EDT
On a stock eclipse-jee-2019-03-R-linux-gtk-x86_64, create a Java project using Java 11 and a dependency to SLF4J 1.7.25.
Add the following two classes in the project in their respective expected folder and files.

package mypackage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Client {
	private static final Logger LOGGER = LoggerFactory.getLogger(Client.class);

	private GitHistory allHistory;

	public void tryRetrieve() {
		update();
	}

	public void update() {
	}
}

package mypackage;

public class GitHistory {
}

Search for the Workspace references to Client#update() (right-click on it, Refrerences / Workspace or use shortcut key). Eclipse sees 0 references in workspace (0 matches filtered from view), instead of the expected reference (namely, Client#tryRetrieve()).

The bug also happens with a Maven project (if using Java 11), and with replacing SLF4J 1.7.25 by SLF4J 1.8.0-beta4.

The bug does not happen when replacing SLF4J by, for example, classgraph 4.4.7, or removing the dependency altogether, or removing the call to LoggerFactory in the Client class source code (even if leaving the import to LoggerFactory there), or removing the reference to GitHistory in Client, or switching from Java 11 to Java 5. In all those cases, Eclipse search finds the expected reference to Client#update().
Comment 1 Olivier Cailloux CLA 2019-03-25 09:42:24 EDT
Created attachment 277992 [details]
Example pom.xml to reproduce the bug
Comment 2 Till Brychcy CLA 2019-03-25 10:18:13 EDT
This is probably a duplicate of bug 545293.

Please try a 4.12 integration build from 
http://download.eclipse.org/eclipse/downloads/
Comment 3 Olivier Cailloux CLA 2019-03-25 14:51:12 EDT
Thanks! The bug does not happen with Eclipse SDK I20190324-1800.
(Note however that it’s much less featured than the Java EE release one I usually use, didn’t find it in the list.)

I expected my bug would not be a duplicate because my example project uses no modules. The SLF4J JAR is added to the classpath and not the module path. Strange…
Comment 4 Olivier Cailloux CLA 2019-03-25 15:10:03 EDT
Apparently a workaround for now is to, after importing the Maven project (relying on Java 11), uncheck in Java compiler projet options “Use compliance from execution environment 'JavaSE-11' on the 'Java build path'” and switch to Compliance level 9.

I only checked on my sample project and it restores the expected search results.
Comment 5 Jay Arthanareeswaran CLA 2019-03-26 01:02:55 EDT
(In reply to Olivier Cailloux from comment #3)
> Thanks! The bug does not happen with Eclipse SDK I20190324-1800.
> (Note however that it’s much less featured than the Java EE release one I
> usually use, didn’t find it in the list.)

I see it listed as "Eclipse IDE for Enterprise Java Developers". That's the one you want, right?
Comment 6 Olivier Cailloux CLA 2019-03-26 05:28:05 EDT
I do not see “Eclipse IDE for Enterprise Java Developers” at https://download.eclipse.org/eclipse/downloads/drops4/I20190324-1800/. What am I missing?
Comment 7 Jay Arthanareeswaran CLA 2019-03-26 05:53:13 EDT
(In reply to Olivier Cailloux from comment #6)
> I do not see “Eclipse IDE for Enterprise Java Developers” at
> https://download.eclipse.org/eclipse/downloads/drops4/I20190324-1800/. What
> am I missing?

Ah, that is the place you go to get the developer builds (mostly, i.e.)

The final bits of all packages are available here:

https://www.eclipse.org/downloads/packages/
Comment 8 Till Brychcy CLA 2019-03-26 06:00:34 EDT
I pointed him there in comment 2

He needs a 4.12 integration build that has the fix for bug 545293 ...
Comment 9 Eclipse Genie CLA 2022-07-28 01:55:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.