Bug 50194 Indenting Java breaks comments
When correcting indentation (ctrl-I in my configuration), java comments are not properly preserved. My original code [1] is 'indented' to code [2], which is unexpected and syntactically incorrect. thanks PhF .. [1] try{ /* for(int i=0; i<8; i++){ System.out.println("something");} */ somethingElse(); .. [2] try{ /* */ for(int i=0; i<8; i++){ System.out.println("something");} */ somethingElse();
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavaDocAutoIndentStrategy.java
jdocWrapParagraphFromLine(document, line, caretOffset, false);
					command.offset= caretOffset[0];
					return;
				}
				
				if (line < document.getNumberOfLines() - 1 && isJavaDocLine(document, line + 1)) {
					String lineDelimiter= document.getLineDelimiter(line);
					String nextLinePrefix= jdocExtractLinePrefix(document, line + 1);
					command.offset += lineDelimiter.length() + nextLinePrefix.length();
				} 
				return;
			
			} else if (endOfLine.trim().length() == 0) {
				
				return;	
			}
		}
		
		String prefix= jdocExtractLinePrefix(document, line);
		boolean wrapAlways=	command.offset >= lineOffset && command.offset <= lineOffset + prefix.length();
		
		flushCommand(document, command);		
		if (wrapAlways || calculateDisplayedWidth(buffer.toString()) > getMargin() || isLineTooShort(document, line)) {
			int[] caretOffset= {command.offset};								
			jdocWrapParagraphFromLine(document, line, caretOffset, wrapAlways);
			if (!wrapAlways)	
				command.offset= caretOffset[0];
		}
	}
	/**