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
while (line == currentLine || isJavaDocLine(document, currentLine)) {
			
			if (buffer.length() != 0 && !Character.isWhitespace(buffer.charAt(buffer.length() - 1))) {
				buffer.append(' ');
				if (currentLine <= caretLine) {
					
					++caret;
				}
			}
			String string= getLineContents(document, currentLine);			
			buffer.append(string);
			currentLine++;
		}
		String paragraph= buffer.toString();
		
		if (paragraph.trim().length() == 0)
			return;
		caretOffset[0]= caretRelativeToParagraphOffset ? caret : 0;
		String delimiter= document.getLineDelimiter(0);
		String wrapped= formatParagraph(paragraph, caretOffset, indent, delimiter, getMargin());
		int beginning= document.getLineOffset(line);
		int end= document.getLineOffset(currentLine);
		document.replace(beginning, end - beginning, wrapped.toString());
		caretOffset[0]= caretRelativeToParagraphOffset ? caretOffset[0] + beginning : caret + beginning;
	}
	
	/**
	 * Line break iterator to handle whitespaces as first class citizens. 
	 */
	private static class LineBreakIterator {