JCAssign assignment = (JCAssign) argument; checkState(getSymbol(assignment.getVariable()).getSimpleName().contentEquals("type")); String typeName = getSymbol(assignment.getExpression()).getSimpleName().toString(); switch (typeName) { case "SET":
encounteredSideEffects = true; fix.replace( tree.getStartPosition(), ((JCAssign) tree).getExpression().getStartPosition(), ""); removeSideEffectsFix.replace(statement, ""); continue;
return Description.NO_MATCH; Symbol sym = ASTHelpers.getSymbol(assign.getExpression()); if (!(sym instanceof VarSymbol)) { return Description.NO_MATCH;
JCTree.JCExpression expression = assign.getExpression();
SuggestedFix.replace( tree.getStartPosition(), ((JCAssign) tree).getExpression().getStartPosition(), ""); fix.merge(replacement);
JCAssign assignment = (JCAssign) argument; checkState(getSymbol(assignment.getVariable()).getSimpleName().contentEquals("type")); String typeName = getSymbol(assignment.getExpression()).getSimpleName().toString(); switch (typeName) { case "SET":
return Description.NO_MATCH; Symbol sym = ASTHelpers.getSymbol(assign.getExpression()); if (!(sym instanceof VarSymbol)) { return Description.NO_MATCH;
@Override public void visitAnnotation(JCAnnotation node) { Annotation a = new Annotation(); a.rawAnnotationTypeReference(toTree(node.getAnnotationType(), FlagKey.TYPE_REFERENCE)); for (JCExpression elem : node.getArguments()) { AnnotationElement e = new AnnotationElement(); if (elem instanceof JCAssign) { JCExpression rawName = ((JCAssign) elem).getVariable(); if (rawName instanceof JCIdent) e.astName(setPos(rawName, new Identifier().astValue(((JCIdent)rawName).getName().toString()))); elem = ((JCAssign) elem).getExpression(); } e.rawValue(toTree(elem)); a.astElements().addToEnd(e); } set(node, a); } }
@Override public void visitAnnotation(JCAnnotation node) { Annotation a = new Annotation(); a.rawAnnotationTypeReference(toTree(node.getAnnotationType(), FlagKey.TYPE_REFERENCE)); for (JCExpression elem : node.getArguments()) { AnnotationElement e = new AnnotationElement(); if (elem instanceof JCAssign) { JCExpression rawName = ((JCAssign) elem).getVariable(); if (rawName instanceof JCIdent) e.astName(setPos(rawName, new Identifier().astValue(((JCIdent)rawName).getName().toString()))); elem = ((JCAssign) elem).getExpression(); } e.rawValue(toTree(elem)); a.astElements().addToEnd(e); } set(node, a); } }
@Override public void visitAnnotation(JCAnnotation node) { Annotation a = new Annotation(); a.rawAnnotationTypeReference(toTree(node.getAnnotationType(), FlagKey.TYPE_REFERENCE)); for (JCExpression elem : node.getArguments()) { AnnotationElement e = new AnnotationElement(); if (elem instanceof JCAssign) { JCExpression rawName = ((JCAssign) elem).getVariable(); if (rawName instanceof JCIdent) e.astName(setPos(rawName, new Identifier().astValue(((JCIdent)rawName).getName().toString()))); elem = ((JCAssign) elem).getExpression(); } e.rawValue(toTree(elem)); a.astElements().addToEnd(e); } set(node, a); } }
@Override public void visitAssign(JCAssign node) { BinaryExpression expr = new BinaryExpression(); expr.rawRight(toTree(node.getExpression())); expr.rawLeft(toTree(node.getVariable())); expr.astOperator(BinaryOperator.ASSIGN); set(node, expr); }
@Override public void visitAssign(JCAssign node) { BinaryExpression expr = new BinaryExpression(); expr.rawRight(toTree(node.getExpression())); expr.rawLeft(toTree(node.getVariable())); expr.astOperator(BinaryOperator.ASSIGN); set(node, expr); }
@Override public void visitAssign(JCAssign node) { BinaryExpression expr = new BinaryExpression(); expr.rawRight(toTree(node.getExpression())); expr.rawLeft(toTree(node.getVariable())); expr.astOperator(BinaryOperator.ASSIGN); set(node, expr); }