@Override public boolean visitCatch(Catch node) { JCVariableDecl exceptionDeclaration = (JCVariableDecl) toTree(node.astExceptionDeclaration()); exceptionDeclaration.getModifiers().flags |= Flags.PARAMETER; return posSet(node, treeMaker.Catch(exceptionDeclaration, (JCBlock) toTree(node.astBody()))); }
@Override public void visitCatch(JCCatch node) { set(node, new Catch() .rawExceptionDeclaration(toTree(node.getParameter(), FlagKey.VARDEF_IS_DEFINITION)) .rawBody(toTree(node.getBlock()))); }
private void toCatches(Argument[] catchArguments, Block[] catchBlocks, StrictListAccessor<lombok.ast.Catch, lombok.ast.Try> astCatches) { if (catchArguments == null || catchBlocks == null || (catchBlocks.length != catchArguments.length)) { return; } for (int i = 0; i < catchBlocks.length; i++) { lombok.ast.Catch cat = new lombok.ast.Catch(); VariableDefinition catchArg = (VariableDefinition) toTree(catchArguments[i]); catchArg.setPosition(toPosition(catchArguments[i].declarationSourceStart, catchArguments[i].sourceEnd)); cat.astExceptionDeclaration(catchArg); cat.astBody((lombok.ast.Block) toTree(catchBlocks[i])); astCatches.addToEnd(cat); } }
@CopyMethod static String getDescription(Catch self) { try { return self.astExceptionDeclaration().astTypeReference().getDescription(); } catch (NullPointerException e) { return null; } } }
@Override public boolean visitCatch(Catch node) { formatter.buildInline(node); formatter.keyword("catch"); formatter.space(); formatter.append("("); visit(node.rawExceptionDeclaration()); formatter.append(")"); formatter.space(); formatter.startSuppressBlock(); visit(node.rawBody()); formatter.endSuppressBlock(); formatter.closeInline(); return true; }
public void checkVarDefOfCatch(Catch node) { BasicChecks.checkVarDefIsSimple(node, node.rawExceptionDeclaration(), "catch blocks", "exception"); }
@Override public List<TypeDescriptor> getCatchTypes(@NonNull JavaContext context, @NonNull Catch catchBlock) { Try aTry = catchBlock.upToTry(); if (aTry != null) { Object nativeNode = getNativeNode(aTry);
private void toCatches(Argument[] catchArguments, Block[] catchBlocks, StrictListAccessor<lombok.ast.Catch, lombok.ast.Try> astCatches) { if (catchArguments == null || catchBlocks == null || (catchBlocks.length != catchArguments.length)) { return; } for (int i = 0; i < catchBlocks.length; i++) { lombok.ast.Catch cat = new lombok.ast.Catch(); VariableDefinition catchArg = (VariableDefinition) toTree(catchArguments[i]); catchArg.setPosition(toPosition(catchArguments[i].declarationSourceStart, catchArguments[i].sourceEnd)); cat.astExceptionDeclaration(catchArg); cat.astBody((lombok.ast.Block) toTree(catchBlocks[i])); astCatches.addToEnd(cat); } }
@CopyMethod static String getDescription(Catch self) { try { return self.astExceptionDeclaration().astTypeReference().getDescription(); } catch (NullPointerException e) { return null; } } }
@Override public boolean visitCatch(Catch node) { formatter.buildInline(node); formatter.keyword("catch"); formatter.space(); formatter.append("("); visit(node.rawExceptionDeclaration()); formatter.append(")"); formatter.space(); formatter.startSuppressBlock(); visit(node.rawBody()); formatter.endSuppressBlock(); formatter.closeInline(); return true; }
public void checkVarDefOfCatch(Catch node) { BasicChecks.checkVarDefIsSimple(node, node.rawExceptionDeclaration(), "catch blocks", "exception"); }
@Override public void visitCatch(JCCatch node) { set(node, new Catch() .rawExceptionDeclaration(toTree(node.getParameter(), FlagKey.VARDEF_IS_DEFINITION)) .rawBody(toTree(node.getBlock()))); }
@Override public boolean visitCatch(Catch node) { JCVariableDecl exceptionDeclaration = (JCVariableDecl) toTree(node.astExceptionDeclaration()); exceptionDeclaration.getModifiers().flags |= Flags.PARAMETER; return posSet(node, treeMaker.Catch(exceptionDeclaration, (JCBlock) toTree(node.astBody()))); }
private void toCatches(Argument[] catchArguments, Block[] catchBlocks, StrictListAccessor<lombok.ast.Catch, lombok.ast.Try> astCatches) { if (catchArguments == null || catchBlocks == null || (catchBlocks.length != catchArguments.length)) { return; } for (int i = 0; i < catchBlocks.length; i++) { lombok.ast.Catch cat = new lombok.ast.Catch(); VariableDefinition catchArg = (VariableDefinition) toTree(catchArguments[i]); catchArg.setPosition(toPosition(catchArguments[i].declarationSourceStart, catchArguments[i].sourceEnd)); cat.astExceptionDeclaration(catchArg); cat.astBody((lombok.ast.Block) toTree(catchBlocks[i])); astCatches.addToEnd(cat); } }
@CopyMethod static String getDescription(Catch self) { try { return self.astExceptionDeclaration().astTypeReference().getDescription(); } catch (NullPointerException e) { return null; } } }
@Override public boolean visitCatch(Catch node) { formatter.buildInline(node); formatter.keyword("catch"); formatter.space(); formatter.append("("); visit(node.rawExceptionDeclaration()); formatter.append(")"); formatter.space(); formatter.startSuppressBlock(); visit(node.rawBody()); formatter.endSuppressBlock(); formatter.closeInline(); return true; }
public void checkVarDefOfCatch(Catch node) { BasicChecks.checkVarDefIsSimple(node, node.rawExceptionDeclaration(), "catch blocks", "exception"); }
@Override public void visitCatch(JCCatch node) { set(node, new Catch() .rawExceptionDeclaration(toTree(node.getParameter(), FlagKey.VARDEF_IS_DEFINITION)) .rawBody(toTree(node.getBlock()))); }
@Override public boolean visitCatch(Catch node) { JCVariableDecl exceptionDeclaration = (JCVariableDecl) toTree(node.astExceptionDeclaration()); exceptionDeclaration.getModifiers().flags |= Flags.PARAMETER; return posSet(node, treeMaker.Catch(exceptionDeclaration, (JCBlock) toTree(node.astBody()))); }
/** * Returns the set of exception types handled by the given catch block. * <p> * This is a workaround for the fact that the Lombok AST API (and implementation) * doesn't support multi-catch statements. * @deprecated Use {@link JavaPsiScanner} APIs instead */ @Deprecated public List<TypeDescriptor> getCatchTypes(@NonNull JavaContext context, @NonNull Catch catchBlock) { TypeReference typeReference = catchBlock.astExceptionDeclaration().astTypeReference(); return Collections.singletonList(new DefaultTypeDescriptor( typeReference.getTypeName())); }