if (!(coveringMetod.getReturnType() instanceof PrimitiveType))
if (coveringMetod == null) { return false; } Type returnType = coveringMetod.getReturnType2(); if (!(returnType instanceof PrimitiveType) || ((PrimitiveType) returnType).getPrimitiveTypeCode() != PrimitiveType.VOID)
	private boolean getIfReturnIntoIfElseAtEndOfVoidMethodProposals(IInvocationContext context, ASTNode covering,			Collection resultingCollections) {		Statement coveringStatement = ASTResolving.findParentStatement(covering);		if (!(coveringStatement instanceof IfStatement)) {			return false;		}		IfStatement ifStatement = (IfStatement) coveringStatement;		if (ifStatement.getElseStatement() != null) {			return false;		}		// 'then' block should have 'return' as last statement		Statement thenStatement = ifStatement.getThenStatement();		if (!(thenStatement instanceof Block)) {			return false;		}		Block thenBlock = (Block) thenStatement;		List thenStatements = thenBlock.statements();		if (thenStatements.isEmpty() || !(thenStatements.get(thenStatements.size() - 1) instanceof ReturnStatement)) {			return false;		}		// method should return 'void'		MethodDeclaration coveringMetod = ASTResolving.findParentMethodDeclaration(covering);		if (!(coveringMetod.getReturnType() instanceof PrimitiveType))			return false;		//		List statements = coveringMetod.getBody().statements();		int ifIndex = statements.indexOf(ifStatement);		if (ifIndex == -1) {			return false;		}		//		PrimitiveType returnType = (PrimitiveType) coveringMetod.getReturnType();		if (returnType.getPrimitiveTypeCode() != PrimitiveType.VOID) {			return false;		}		// ok, we could produce quick assist		if (resultingCollections == null) {			return true;		}		//		AST ast = coveringStatement.getAST();		ASTRewrite rewrite = ASTRewrite.create(ast);		// remove last 'return' in 'then' block		ListRewrite listRewriter = rewrite.getListRewrite(thenBlock,				(ChildListPropertyDescriptor) ifStatement.getLocationInParent());		listRewriter.remove((ASTNode) thenStatements.get(thenStatements.size() - 1), null);		// prepare original nodes		Expression conditionPlaceholder = (Expression) rewrite.createMoveTarget(ifStatement.getExpression());		Statement thenPlaceholder = (Statement) rewrite.createMoveTarget(ifStatement.getThenStatement());		// prepare 'else' block		Block elseBlock = ast.newBlock();		for (int i = ifIndex + 1; i < statements.size(); i++) {			Statement statement = (Statement) statements.get(i);			elseBlock.statements().add(rewrite.createMoveTarget(statement));		}		// prepare new 'if' statement		IfStatement newIf = ast.newIfStatement();		newIf.setExpression(conditionPlaceholder);		newIf.setThenStatement(thenPlaceholder);		newIf.setElseStatement(elseBlock);		rewrite.replace(ifStatement, newIf, null);		// add correction proposal		String label = CorrectionMessages.getString("AdvancedQuickAssistProcessor.convertToIfElse.description"); //$NON-NLS-1$		Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_LOCAL);		ASTRewriteCorrectionProposal proposal = new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(),				rewrite, 1, image);		resultingCollections.add(proposal);		return true;	}