@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())); }
if (!first.astTypeReference().astParts().last().getTypeName().equals( TYPE_INT)) { return false; if (!second.astTypeReference().astParts().last().getTypeName().equals( VIEW)) { return false; if (!third.astTypeReference().astParts().last().getTypeName().equals( VIEW_GROUP)) { return false;
TypeReferencePart type = iterator.next().astTypeReference().astParts().last(); if (!type.getTypeName().equals(TYPE_BOOLEAN) || !iterator.hasNext()) { return false; type = iterator.next().astTypeReference().astParts().last(); if (!type.getTypeName().equals(TYPE_INT)) { return false;
@Nullable private static String getFieldType(@NonNull NormalTypeBody cls, @NonNull String name) { List<Node> children = cls.getChildren(); for (Node child : children) { if (child.getClass() == VariableDeclaration.class) { VariableDeclaration declaration = (VariableDeclaration) child; VariableDefinition definition = declaration.astDefinition(); return definition.astTypeReference().toString(); } } return null; }
/** * Returns true if this method looks like it's overriding android.view.View's * {@code public void layout(int l, int t, int r, int b)} */ private static boolean isLayoutMethod(MethodDeclaration node) { if (LAYOUT.equals(node.astMethodName().astValue())) { StrictListAccessor<VariableDefinition, MethodDeclaration> parameters = node.astParameters(); if (parameters != null && parameters.size() == 4) { Iterator<VariableDefinition> iterator = parameters.iterator(); for (int i = 0; i < 4; i++) { if (!iterator.hasNext()) { return false; } VariableDefinition next = iterator.next(); TypeReferencePart type = next.astTypeReference().astParts().last(); if (!TYPE_INT.equals(type.getTypeName())) { return false; } } return true; } } return false; }
/** * Returns true if this method looks like it's overriding android.view.View's * {@code protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)} */ private static boolean isOnMeasureMethod(MethodDeclaration node) { if (ON_MEASURE.equals(node.astMethodName().astValue())) { StrictListAccessor<VariableDefinition, MethodDeclaration> parameters = node.astParameters(); if (parameters != null && parameters.size() == 2) { VariableDefinition arg0 = parameters.first(); VariableDefinition arg1 = parameters.last(); TypeReferencePart type1 = arg0.astTypeReference().astParts().last(); TypeReferencePart type2 = arg1.astTypeReference().astParts().last(); return TYPE_INT.equals(type1.getTypeName()) && TYPE_INT.equals(type2.getTypeName()); } } return false; }
/** * Returns true if this method looks like it's overriding android.view.View's * {@code protected void onDraw(Canvas canvas)} */ private static boolean isOnDrawMethod(MethodDeclaration node) { if (ON_DRAW.equals(node.astMethodName().astValue())) { StrictListAccessor<VariableDefinition, MethodDeclaration> parameters = node.astParameters(); if (parameters != null && parameters.size() == 1) { VariableDefinition arg0 = parameters.first(); TypeReferencePart type = arg0.astTypeReference().astParts().last(); String typeName = type.getTypeName(); if (typeName.equals(CANVAS)) { return true; } } } return false; }
@CopyMethod static TypeReference getEffectiveTypeReference(VariableDefinitionEntry self) { VariableDefinition parent = self.upToVariableDefinition(); if (parent == null) throw new AstException( self, "Cannot calculate type reference of a VariableDefinitionEntry without a VariableDefinition as parent"); TypeReference typeRef = parent.astTypeReference().copy(); return typeRef.astArrayDimensions(typeRef.astArrayDimensions() + self.astArrayDimensions() + (parent.astVarargs() ? 1 : 0)); }
@CopyMethod static TypeReference getEffectiveTypeReference(VariableDefinitionEntry self) { VariableDefinition parent = self.upToVariableDefinition(); if (parent == null) throw new AstException( self, "Cannot calculate type reference of a VariableDefinitionEntry without a VariableDefinition as parent"); TypeReference typeRef = parent.astTypeReference().copy(); return typeRef.astArrayDimensions(typeRef.astArrayDimensions() + self.astArrayDimensions() + (parent.astVarargs() ? 1 : 0)); }
@CopyMethod static TypeReference getEffectiveTypeReference(VariableDefinitionEntry self) { VariableDefinition parent = self.upToVariableDefinition(); if (parent == null) throw new AstException( self, "Cannot calculate type reference of a VariableDefinitionEntry without a VariableDefinition as parent"); TypeReference typeRef = parent.astTypeReference().copy(); return typeRef.astArrayDimensions(typeRef.astArrayDimensions() + self.astArrayDimensions() + (parent.astVarargs() ? 1 : 0)); }
@Override public boolean visitVariableDefinition(VariableDefinition node) { JCModifiers mods = (JCModifiers) toTree(node.astModifiers()); JCExpression vartype = toExpression(node.astTypeReference());
@Override public boolean visitVariableDefinition(VariableDefinition node) { JCModifiers mods = (JCModifiers) toTree(node.astModifiers()); JCExpression vartype = toExpression(node.astTypeReference());
@Override public boolean visitVariableDefinition(VariableDefinition node) { JCModifiers mods = (JCModifiers) toTree(node.astModifiers()); JCExpression vartype = toExpression(node.astTypeReference());
lombok.ast.VariableDefinition varDef = new lombok.ast.VariableDefinition(); varDef.astModifiers(toModifiers(first.modifiers, first.annotations, first.modifiersSourceStart, first.declarationSourceStart)); varDef.astTypeReference((lombok.ast.TypeReference) toTree(winner)); if ((first.type.bits & ASTNode.IsVarArgs) != 0) { varDef.astVarargs(true);
lombok.ast.VariableDefinition varDef = new lombok.ast.VariableDefinition(); varDef.astModifiers(toModifiers(first.modifiers, first.annotations, first.modifiersSourceStart, first.declarationSourceStart)); varDef.astTypeReference((lombok.ast.TypeReference) toTree(winner)); if ((first.type.bits & ASTNode.IsVarArgs) != 0) { varDef.astVarargs(true);
lombok.ast.VariableDefinition varDef = new lombok.ast.VariableDefinition(); varDef.astModifiers(toModifiers(first.modifiers, first.annotations, first.modifiersSourceStart, first.declarationSourceStart)); varDef.astTypeReference((lombok.ast.TypeReference) toTree(winner)); if ((first.type.bits & ASTNode.IsVarArgs) != 0) { varDef.astVarargs(true);
addToMap(((VariableDeclaration)node).astDefinition().astModifiers(), node); addToMap(((VariableDeclaration)node).astDefinition().astModifiers().astAnnotations(), node); addToMap(((VariableDeclaration)node).astDefinition().astTypeReference(), node); addToMap(((VariableDeclaration)node).astDefinition().astVariables().first().astName(), node); } else if (node instanceof TypeDeclaration) {