Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 560707

Summary: Debug expressions in system classes w/modules cause "The package X is accessible from more than one module: Y"
Product: [Eclipse Project] JDT Reporter: Jesper Moller <jesper>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: dragonmacher, loskutov, sarika.sinha
Version: 4.15   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Jesper Moller CLA 2020-03-02 17:26:04 EST
Steps to reproduce

Make a Java project with a module-info, add a breakpoint at StringBuilder.append(String), start debugging, and try to evaluate anything.

void main(String args[]) {
     System.out.println("Hello, " + args[0]);
}

You'll get the error: "The package java.lang is accessible from more than one module: java.base, Xxx"

(Not related to lambdas specifically, by the way, caused by trying to compile an expression in an imported package, as fas as I can tell)
Comment 1 Sarika Sinha CLA 2020-03-04 05:53:56 EST
(In reply to Jesper Moller from comment #0)
> Steps to reproduce
> 
> Make a Java project with a module-info, add a breakpoint at
> StringBuilder.append(String), start debugging, and try to evaluate anything.
> 
> void main(String args[]) {
>      System.out.println("Hello, " + args[0]);
> }
> 
> You'll get the error: "The package java.lang is accessible from more than
> one module: java.base, Xxx"
> 
> (Not related to lambdas specifically, by the way, caused by trying to
> compile an expression in an imported package, as fas as I can tell)
I tried to run this in Debug Shell System.out.println(str); and I see the reason as:
	Evaluation failed. Reason(s):
		Evaluations must contain either an expression or a block of well-formed statements
Comment 2 Jesper Moller CLA 2020-03-04 18:40:30 EST
(In reply to Sarika Sinha from comment #1)

I wasn't clear about this: The code shown should go into a Java file in a project project, and the error message shows up in the log of the debugger, not in the debug expressions view.
Comment 3 D M CLA 2021-07-27 16:18:29 EDT
I can confirm this issue.   This is a major impediment to my debugging workflow.

I see this issue when I set a breakpoint in a javax.swing package.   When that breakpoint hits and I try to use the Debug Shell window to execute statements, the Debug Shell prints:


    "Evaluations must contain either an expression or a block of well-formed statements"


The Error Log has an entry that shows:

   "Compile error during code evaluation: The package javax.swing is accessible from more than one module: <unnamed>, java.desktop"


I use this feature to debug things happening inside of Java's libraries.
Comment 4 D M CLA 2021-07-27 18:05:42 EDT
System Info:

>java --version
openjdk 11.0.4 2019-07-16 LTS
OpenJDK Runtime Environment Corretto-11.0.4.11.1 (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.4.11.1 (build 11.0.4+11-LTS, mixed mode)



Eclipse IDE for Java Developers (includes Incubating components)

Version: 2021-06 (4.20.0)
Build id: 20210612-2011


Amazon Linux OS
Comment 5 Andrey Loskutov CLA 2021-08-05 08:01:28 EDT

*** This bug has been marked as a duplicate of bug 575039 ***