private List<String> getAliases(SingleMemberAnnotationExpr annotation) { List<String> aliases = new ArrayList<>(); if (annotation.getMemberValue() instanceof ArrayInitializerExpr) { ArrayInitializerExpr memberValue = (ArrayInitializerExpr) annotation.getMemberValue(); for (Expression expression : memberValue.getValues()) { aliases.add(expression.toString().replaceAll("\"", "")); } } return aliases; } }
@Override public ResolvedType visit(ConditionalExpr node, Boolean solveLambdas) { return node.getThenExpr().accept(this, solveLambdas); }
@Override public boolean doIsEquals(Expression first, Expression second) { return first.equals(second); } }
private String createMemberParamValue(AnnotationExpr a) { Expression memberValue = a.asSingleMemberAnnotationExpr().getMemberValue(); if (memberValue.getClass().isAssignableFrom(StringLiteralExpr.class)) return memberValue.asStringLiteralExpr().asString(); if (memberValue.getClass().isAssignableFrom(NameExpr.class)) return memberValue.asNameExpr().getNameAsString(); throw new IllegalArgumentException(String.format("Javadoc param type (%s) not supported.", memberValue.toString())); }
private Type type(final Expression expr, final Context ctx) { LocalStack vars = new LocalVariableCollector().accept(expr, ctx); Type type = vars.get(expr.toStringWithoutComments()); if (type == null) { type = expr.accept(new TypeCollector(), ctx); } return type; }
List<Expression> args = ((MethodCallExpr)parent).getArguments(); args.set(args.indexOf(n), v); v.setParentNode(parent); } else if (parent instanceof ExpressionStmt) { ((ExpressionStmt)parent).setExpression(v); System.out.println(" expression replacing: " + v.toString()); throw new RuntimeException();
NameExpr scopeAsName = scope.asNameExpr(); SymbolReference<ResolvedTypeDeclaration> symbolReference = this.solveType(scopeAsName.getName().getId()); if (symbolReference.isSolved() && symbolReference.getCorrespondingDeclaration().isType()) { throw new UnsolvedSymbolException(scope.toString(), wrappedNode.toString(), e);
private static boolean appearsInInvocationContext(Expression expression) { if (expression.getParentNode().isPresent()) { Node parent = expression.getParentNode().get(); if (parent instanceof ExpressionStmt) { return false; } if (parent instanceof MethodCallExpr) { return true; } throw new UnsupportedOperationException(parent.getClass().getCanonicalName()); } return false; }
@Override public int hashCode() { int result = typeSolver.hashCode(); result = 31 * result + expression.hashCode(); result = 31 * result + T.hashCode(); return result; }
private String createMemberParamValue(AnnotationExpr a) { Expression memberValue = a.asSingleMemberAnnotationExpr().getMemberValue(); if (memberValue.getClass().isAssignableFrom(StringLiteralExpr.class)) return memberValue.asStringLiteralExpr().asString(); if (memberValue.getClass().isAssignableFrom(NameExpr.class)) return memberValue.asNameExpr().getNameAsString(); throw new IllegalArgumentException(String.format("Javadoc param type (%s) not supported.", memberValue.toString())); }
private static boolean appearsInInvocationContext(Expression expression) { if (expression.getParentNode().isPresent()) { Node parent = expression.getParentNode().get(); if (parent instanceof ExpressionStmt) { return false; } if (parent instanceof MethodCallExpr) { return true; } throw new UnsupportedOperationException(parent.getClass().getCanonicalName()); } return false; }
if (args.size() > 0) { Expression arg = args.get(0); Object result = arg.accept(new LiteralCollector(), ctx); if (result instanceof Type) { if (type == null) { } else { Map<String, Object> vals = new StaticValueCollector().accept(expr, ctx); defaultValue = arg.toStringWithoutComments(); defaultValue = vals.getOrDefault(defaultValue, defaultValue);
@Override public int hashCode() { int result = typeSolver.hashCode(); result = 31 * result + expression.hashCode(); result = 31 * result + T.hashCode(); return result; }
protected void prepareReturnStmt(MethodDeclaration methodDeclaration, ReturnStmt returnStmt) { returnStmt.getExpression().ifPresent(expression -> { String returnStmtStr = expression.toString(); Matcher matcher = RETURN_STMT_PATTERN.matcher(returnStmtStr); if (!returnMap.containsKey(methodDeclaration.getNameAsString())) { returnMap.put(methodDeclaration.getNameAsString(), DfCollectionUtil.newArrayList()); } returnMap.get(methodDeclaration.getNameAsString()).add(matcher.find() ? matcher.group(0) : "##unanalyzable##"); }); } }
@Override public ResolvedType visit(AssignExpr node, Boolean solveLambdas) { return node.getTarget().accept(this, solveLambdas); }
private static boolean appearsInInvocationContext(Expression expression) { if (expression.getParentNode().isPresent()) { Node parent = expression.getParentNode().get(); if (parent instanceof ExpressionStmt) { return false; } if (parent instanceof MethodCallExpr) { return true; } throw new UnsupportedOperationException(parent.getClass().getCanonicalName()); } return false; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ExpressionCompatibleWithType that = (ExpressionCompatibleWithType) o; if (!typeSolver.equals(that.typeSolver)) return false; if (!expression.equals(that.expression)) return false; return T.equals(that.T); }
@Override public int hashCode() { int result = typeSolver.hashCode(); result = 31 * result + expression.hashCode(); result = 31 * result + T.hashCode(); return result; }
private List<String> getAliases(SingleMemberAnnotationExpr annotation) { List<String> aliases = new ArrayList<>(); if (annotation.getMemberValue() instanceof ArrayInitializerExpr) { ArrayInitializerExpr memberValue = (ArrayInitializerExpr) annotation.getMemberValue(); for (Expression expression : memberValue.getValues()) { aliases.add(expression.toString().replaceAll("\"", "")); } } return aliases; } }
@Override public void visit(SingleMemberAnnotationExpr n, Void arg) { // performance n.getMemberValue().accept(this, arg); }