@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 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 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()))); }
@CopyMethod static String getDescription(Catch self) { try { return self.astExceptionDeclaration().astTypeReference().getDescription(); } catch (NullPointerException e) { return null; } } }
@CopyMethod static String getDescription(Catch self) { try { return self.astExceptionDeclaration().astTypeReference().getDescription(); } catch (NullPointerException e) { return null; } } }
@CopyMethod static String getDescription(Catch self) { try { return self.astExceptionDeclaration().astTypeReference().getDescription(); } catch (NullPointerException e) { return null; } } }
/** * 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())); }
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); } }
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); } }
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); } }
} else { for (Catch aCatch : tryCatch.astCatches()) { TypeReference catchType = aCatch.astExceptionDeclaration().astTypeReference();
VariableDefinition variableDefinition = c.astExceptionDeclaration(); TypeReference typeReference = variableDefinition.astTypeReference(); String fqcn = null;
@Override public boolean visitTry(lombok.ast.Try node) { TryStatement tryStatement = new TryStatement(); tryStatement.sourceStart = start(node); tryStatement.sourceEnd = end(node); tryStatement.tryBlock = (Block) toTree(node.astBody()); int catchSize = node.astCatches().size(); if (catchSize > 0) { tryStatement.catchArguments = new Argument[catchSize]; tryStatement.catchBlocks = new Block[catchSize]; int i = 0; for (lombok.ast.Catch c : node.astCatches()) { tryStatement.catchArguments[i] = (Argument)toTree(c.astExceptionDeclaration()); tryStatement.catchBlocks[i] = (Block) toTree(c.astBody()); i++; } } tryStatement.finallyBlock = (Block) toTree(node.astFinally()); return set(node, tryStatement); }
@Override public boolean visitTry(lombok.ast.Try node) { TryStatement tryStatement = new TryStatement(); tryStatement.sourceStart = start(node); tryStatement.sourceEnd = end(node); tryStatement.tryBlock = (Block) toTree(node.astBody()); int catchSize = node.astCatches().size(); if (catchSize > 0) { tryStatement.catchArguments = new Argument[catchSize]; tryStatement.catchBlocks = new Block[catchSize]; int i = 0; for (lombok.ast.Catch c : node.astCatches()) { tryStatement.catchArguments[i] = (Argument)toTree(c.astExceptionDeclaration()); tryStatement.catchBlocks[i] = (Block) toTree(c.astBody()); i++; } } tryStatement.finallyBlock = (Block) toTree(node.astFinally()); return set(node, tryStatement); }
@Override public boolean visitTry(lombok.ast.Try node) { TryStatement tryStatement = new TryStatement(); tryStatement.sourceStart = start(node); tryStatement.sourceEnd = end(node); tryStatement.tryBlock = (Block) toTree(node.astBody()); int catchSize = node.astCatches().size(); if (catchSize > 0) { tryStatement.catchArguments = new Argument[catchSize]; tryStatement.catchBlocks = new Block[catchSize]; int i = 0; for (lombok.ast.Catch c : node.astCatches()) { tryStatement.catchArguments[i] = (Argument)toTree(c.astExceptionDeclaration()); tryStatement.catchBlocks[i] = (Block) toTree(c.astBody()); i++; } } tryStatement.finallyBlock = (Block) toTree(node.astFinally()); return set(node, tryStatement); }
} else { for (Catch aCatch : tryCatch.astCatches()) { TypeReference catchType = aCatch.astExceptionDeclaration(). astTypeReference(); if (isSecurityException(context,