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

Bug 522467

Summary: [9][quick fix] Fix project setup... does not add requires 'requires module' to module-info.java if the type matches types from multiple modules
Product: [Eclipse Project] JDT Reporter: Kalyan Prasad Tatavarthi <kalyan_prasad>
Component: UIAssignee: Kalyan Prasad Tatavarthi <kalyan_prasad>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, noopur_gupta
Version: 4.7   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: stalebug
Bug Depends on: 506377    
Bug Blocks:    

Description Kalyan Prasad Tatavarthi CLA 2017-09-19 02:59:48 EDT
1) Create a Java 9 project
2) Create a module-info.java class, by rightclicking on the project select 
configure --> Create module-info.java 
3) Create a class and add the statement : protected static Driver d;
4) Remove the Java9 jre from Java Build Path --> Libraries tab
Now the QuickFix on the above statement provides the quick fix
"Fix project setup..." 
5 ) Click on the above quick fix. A new Dialog box opens with suggestion
"Add library 'JRE System Library [JavaSE-9]' to build path of '$PROJECT_NAME'"
6) Click on this suggestion. The library is added to build path and the import statement "import java.sql.Driver;" gets added.

But the error is still reported on the import statement and the statement "protected static Driver d;" 

This is because "requires java.sql;" needs to be added to the module-info.java file when the import is added.
Comment 1 Kalyan Prasad Tatavarthi CLA 2017-09-19 03:06:19 EDT
Bug 506337 addresses part of the issue. That is when the Quick fix is being provided , if the type 'Driver' had only one match in the java 1.9 jar file or if all the matches had belonged to a single module then this information is provided in the quick fix. Upon selection of the quick fix the "requires $MODULENAME;" is also added to module-info.java.

For the case explained in this bug, for the type Driver, there are multiple matches in various modules of java 9 library.
Comment 2 Eclipse Genie CLA 2020-03-13 10:23:58 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.