Community
Participate
Working Groups
(1) Have unused imports in module-info.java (2) Try to get rid of them (2.a) Quick fix from the editor (2.b) Multi fix from the Problems view Result with either (2.a) or (2.b): org.eclipse.core.runtime.CoreException: The fix 'Remove unused import' generated a null change. at org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.createChange(CompilationUnitRewriteOperationsFixCore.java:103) at org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal.createTextChange(FixCorrectionProposal.java:152) at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.createChange(CUCorrectionProposal.java:203) at org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal.getChange(ChangeCorrectionProposal.java:328) at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.getTextChange(CUCorrectionProposal.java:214) at org.eclipse.jdt.core.manipulation.CUCorrectionProposalCore.getAdditionalProposalInfo(CUCorrectionProposalCore.java:132) at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.getAdditionalProposalInfo(CUCorrectionProposal.java:138) at org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal.getAdditionalProposalInfo(FixCorrectionProposal.java:134) at org.eclipse.jface.text.contentassist.AdditionalInfoController$Timer$2$1.run(AdditionalInfoController.java:116) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Additionally, in the editor you may see: java.lang.NullPointerException at org.eclipse.jdt.core.manipulation.CUCorrectionProposalCore.getAdditionalProposalInfo(CUCorrectionProposalCore.java:133) at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.getAdditionalProposalInfo(CUCorrectionProposal.java:138) at org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal.getAdditionalProposalInfo(FixCorrectionProposal.java:134) at org.eclipse.jface.text.contentassist.AdditionalInfoController$Timer$2$1.run(AdditionalInfoController.java:116) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
The quick fix is not to blame, bug JDT/Core's ASTRewriteAnalyzer.visit(CompilationUnit) skips package & imports if it detects a module. Outch.
New Gerrit change created: https://git.eclipse.org/r/133491
(In reply to Eclipse Genie from comment #2) > New Gerrit change created: https://git.eclipse.org/r/133491 Draft of a fix. Not tests yet.
Test has been added in patch set #2 (rebased as #3) - which, when run without the fix, demonstrates that rewriting of imports in module-info does not work. @Jay, @Manoj, can one of you please +1 for RC1? TIA.
I also smoke-tested in the IDE that organize imports now works in module-info.
(In reply to Stephan Herrmann from comment #4) > Test has been added in patch set #2 (rebased as #3) - which, when run > without the fix, demonstrates that rewriting of imports in module-info does > not work. > > @Jay, @Manoj, can one of you please +1 for RC1? TIA. +1
Gerrit change https://git.eclipse.org/r/133491 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=9a6c75cf8038040b323dac130925f5927eb35cc5
(In reply to Eclipse Genie from comment #7) > Gerrit change https://git.eclipse.org/r/133491 was merged to [master]. > Commit: > http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/ > ?id=9a6c75cf8038040b323dac130925f5927eb35cc5 Thanks Manoj, the change has thus been released for 4.11 RC1
Verified for 4.11 RC1 using build I20190227-1800