Bug 51451 [formatting] unstable comment formatting
- open TestCase - in the editor set the carret in a method declaration's name (e.g., ru|n()) - press CTRL-SHIFT-F multiple times -> the formatting changes in each `format'
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaFormattingStrategy.java
Assert.isLegal(fPartitions.size() > 0);
		Assert.isLegal(fPositions.size() > 0);
		final int[] positions= (int[])fPositions.removeFirst();
		
		final TypedPosition partition= (TypedPosition)fPartitions.removeFirst();
		final Map preferences= getPreferences();
		final IDocument document= getViewer().getDocument();
		int indent= 0;
		
		
		
		
		
		try {
			
			
			Position toFormat= new Position(partition.offset, partition.length);
			stripLeadingWS(document, toFormat);
			stripTrailingWS(document, toFormat, partition);
			
			IDocument formattedDoc= new Document(CodeFormatterUtil.format(CodeFormatter.K_COMPILATION_UNIT, document.get(), toFormat.offset, toFormat.length, indent, positions, TextUtilities.getDefaultLineDelimiter(document), preferences));
			
			int leadingEmptyLines= document.getNumberOfLines(partition.offset, toFormat.offset - partition.offset) - 1; 
			int trailingEmptyLines= document.getNumberOfLines(toFormat.offset + toFormat.length, partition.offset + partition.length - (toFormat.offset + toFormat.length)) - 1;
			int from= getLeadingWSOffset(leadingEmptyLines, formattedDoc);
			int to= getTrailingWSOffset(trailingEmptyLines, formattedDoc);
			String formatted= formattedDoc.get(from, to - from);
			
			final String raw= document.get(partition.getOffset(), partition.getLength());
			if (formatted != null && !formatted.equals(raw))