Bug 553453

Summary: "Organize import" removes comment in module-info.java
Product: [Eclipse Project] JDT Reporter: Vikas Chandra <Vikas.Chandra>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: jjohnstn, stephan.herrmann
Version: 4.14   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=553472
Whiteboard: stalebug
Attachments:
Description Flags
Project to recreate this problem none

Description Vikas Chandra CLA 2019-11-26 00:04:52 EST
Created attachment 280776 [details]
Project to recreate this problem

1) Import attached project
2) Open module-info.java file

Do Control-Shift-O

The javadoc comment in module-info is totally removed.
Comment 1 Vikas Chandra CLA 2019-11-26 00:06:33 EST
Problem happens on 4.13 GA build. So this is not a regression.
Comment 2 Stephan Herrmann CLA 2019-11-26 04:47:50 EST
Importing this project into build I20191120-1800 produces:

java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getDeclarationModifiers(Scope.java:2533)
	at org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference.reportInvalidType(JavadocSingleTypeReference.java:114)
	at org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference.internalResolveType(JavadocSingleTypeReference.java:94)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:629)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:625)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:621)
	at org.eclipse.jdt.internal.compiler.ast.Javadoc.resolveReference(Javadoc.java:403)
	at org.eclipse.jdt.internal.compiler.ast.Javadoc.resolve(Javadoc.java:293)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:645)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1072)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1114)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:280)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:346)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:193)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:94)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1315)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:131)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:113)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:93)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:90)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:157)
	at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:94)
	at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:107)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:76)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:210)
Comment 3 Stephan Herrmann CLA 2019-11-26 05:09:03 EST
(In reply to Stephan Herrmann from comment #2)

Over to bug 553472
Comment 4 Vikas Chandra CLA 2019-11-26 05:11:09 EST
(In reply to Stephan Herrmann from comment #3)
> (In reply to Stephan Herrmann from comment #2)
> 
> Over to bug 553472

Yes I can reproduce this.
Comment 5 Vikas Chandra CLA 2019-11-26 05:13:10 EST
Steps to recreate this bug

1) Create a project with module-info.java
2) Add 
/**
 * @author vikchand
 *
 */

in javadoc in module-info

3) Add import java.lang.*;
4) Press Control-Shift-O
Comment 6 Eclipse Genie CLA 2022-02-16 09:41:52 EST
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.
Comment 7 Vikas Chandra CLA 2022-02-16 12:29:40 EST
still present in latest I build
Comment 8 Eclipse Genie CLA 2024-02-10 16:01:09 EST
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.