Bug 28824 Quick Fix: Type Mismatch -> Cast bug [quick fix]
When using code assist to apply a cast to the following statement: DefaultMutableTreeNode root = getParentContainer().treeMapperTree.getModel ().getRoot(); You get: DefaultMutableTreeNode root = getParentContainer().(DefaultMutableTreeNode) treeMapperTree.getModel().getRoot(); When you should get: DefaultMutableTreeNode root = (DefaultMutableTreeNode) getParentContainer ().treeMapperTree.getModel().getRoot(); Seems to be getting confused about where the cast statement should go because the treeMapperTree isn't using getters (i.e. getTreeMapperTree()). When using getters then the cast works fine... Should also work without getters, hence bug.
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/astrewrite/ASTRewritingExpressionsTest.java
ExpressionStatement statement= (ExpressionStatement) statements.get(1);
			SuperMethodInvocation invocation= (SuperMethodInvocation) statement.getExpression();
			Name qualifier= (Name) invocation.getQualifier();
			rewrite.markAsRemoved(qualifier);
			
			Name placeHolder= (Name) rewrite.createCopy(qualifier);
			
			FieldAccess newFieldAccess= ast.newFieldAccess();
			newFieldAccess.setExpression(placeHolder);
			newFieldAccess.setName(ast.newSimpleName("count"));
			
			ASTNode arg1= (ASTNode) invocation.arguments().get(0);
			rewrite.markAsReplaced(arg1, newFieldAccess);
		}
		{ 
			ExpressionStatement statement= (ExpressionStatement) statements.get(2);
			SuperMethodInvocation invocation= (SuperMethodInvocation) statement.getExpression();
			
			MethodInvocation arg1= (MethodInvocation) invocation.arguments().get(0);
			rewrite.markAsRemoved(arg1);
			
			MethodInvocation innerArg= (MethodInvocation) arg1.arguments().get(0);
			
			ASTNode placeHolder= rewrite.createCopy((ASTNode) innerArg.getExpression());
			
			rewrite.markAsReplaced((ASTNode) invocation.getQualifier(), placeHolder);
		}
			
		ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal("", cu, rewrite, 10, null);
		proposal.getCompilationUnitChange().setSave(true);