On Windows 10 I downloaded and installed Eclipse Oxygen [Release (4.7.1a) Build id: 20171005-1200] using the Eclipse Installer.
I then created a trivial Java project (no module stuff) using the New Project wizard:
public class Demo1 { public static void main(String[] args) { new Demo1().test(0L); } void test(int i) { doStuff(); } void test(long l) { doStuff(); } void doStuff() { String s = "abcde"; s = s.substring(2,4); System.out.print("s="); System.out.println( s.toString()); } }
It runs OK, and if I do CTL=>Open Implementation for test() or doStuff() or System or String or toString() or substr() everything is fine.
However, for println() and print() an error message is displayed:
- Also, a stack trace is written to the Error Log:
!ENTRY org.eclipse.jdt.ui 4 0 2017-10-23 01:42:54.695 !MESSAGE An error occurred while searching for implementations of 'print'. See error log for details. !STACK 1 Java Model Exception: Java Model Status [ is not on its project's build path] at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:570) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:247) at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241) at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241) at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:107) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:583) at org.eclipse.jdt.internal.core.BinaryType.getElementInfo(BinaryType.java:287) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:306) at org.eclipse.jdt.internal.core.BinaryType.isInterface(BinaryType.java:725) at org.eclipse.jdt.internal.ui.javaeditor.JavaElementImplementationHyperlink$1.run(JavaElementImplementationHyperlink.java:237) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119) !SUBENTRY 1 org.eclipse.jdt.core 4 1006 2017-10-23 01:42:54.695 !MESSAGE is not on its project's build path
- However, after clicking OK, the Implementation popup is displayed as expected, and clicking PrintStream sends me to the correct method implementation:
This looks like a bug in Eclipse or its installer, but the issue is very basic yet I don't see any reports for it. I have a few questions arising:
Does anyone else get this issue, or is it working?
Is there any configuration I could/should do to fix this?
Any ideas why Open Implementation would be giving the error only for print() and println()?