Bug 40038 [typing] Smart semicolon fooled by method braces
Build: I20030710 Start writing a setter method, like this: public void setValue(int i) {} Then position cursor between the braces and fill in the method body. You end up with this: public void setValue(int i) {this.value=i}; Problem: when you type the semicolon, it jumps over the closing method body brace and places it at the end of the line, resulting in a syntax error.
org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/SmartSemicolonAutoEditStrategyTest.java
IDocument.DEFAULT_CONTENT_TYPE
		};
		fPartitioner= new DefaultPartitioner(new FastJavaPartitionScanner(), types);
		fPartitioner.connect(fDocument); 
		fDocument.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, fPartitioner); 
	}
	private void verifySemicolonPosition(int caret, int expected) throws BadLocationException {
		IRegion region= fDocument.getLineInformation(0);
		ITextSelection selection= new TextSelection(fDocument, region.getOffset(), region.getLength());
		int pos= SmartSemicolon.computeCharacterPosition(fDocument, selection, caret, SEMI, IJavaPartitions.JAVA_PARTITIONING);
		Assert.assertEquals(expected, pos);
	}
	
	private void verifyBracePosition(int caret, int expected) throws BadLocationException {
		IRegion region= fDocument.getLineInformation(0);
		ITextSelection selection= new TextSelection(fDocument, region.getOffset(), region.getLength());
		int pos= SmartSemicolon.computeCharacterPosition(fDocument, selection, caret, BRACE, IJavaPartitions.JAVA_PARTITIONING);
		if (pos == -1) pos= caret;
		Assert.assertEquals(expected, pos);
	}
	
	
	
	public void testGoToEOL() throws BadLocationException {
		fDocument.set("public void foobar()");
		verifySemicolonPosition(5, 20);
	}
	
	public void testGoToExisting() throws BadLocationException {
		System.out.println("testGoToExisting disabled - unwanted functionality");