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
document.replace(partition.getOffset(), partition.getLength(), formatted);
		} catch (BadLocationException exception) {
			
			JavaPlugin.log(exception);
		}
	}
		
	/**
	 * Strips leading white space off the region described by <code>toFormat</code>
	 * 
	 * @param document the doc
	 * @param toFormat the position
	 * @throws BadLocationException
	 */
	private void stripLeadingWS(final IDocument document, final Position toFormat) throws BadLocationException {
		
		
		
		
		int offset= toFormat.getOffset();
		int length= toFormat.getLength();
		for (int i= 0; i < length; i++) {
			if (!Character.isWhitespace(document.getChar(offset + i)))
				break;
			toFormat.offset++;
			toFormat.length--;
		}
	}
	/**
	 * Strips any trailing white space off the region described by <code>toFormat</code>.