private static ConditionalExpression createPattern() { final Expression target = new TypeReferenceExpression(new AnyNode().toType()).makeOptional().toExpression(); final MemberReferenceExpression access = new MemberReferenceExpression(target, Pattern.ANY_STRING); @SuppressWarnings("UnnecessaryLocalVariable") final ConditionalExpression pattern = new ConditionalExpression( new BinaryOperatorExpression( access.withName("fieldAccess").toExpression(), BinaryOperatorType.EQUALITY, new NullReferenceExpression() ), new AssignmentExpression( new BackReference("fieldAccess").toExpression(), AssignmentOperatorType.ASSIGN, target.clone() .invoke(Pattern.ANY_STRING, new TypedLiteralNode("class", String.class).toExpression()) .withName("methodCall") .toExpression() ), new BackReference("fieldAccess").toExpression() ); return pattern; }
astBuilder.convertType(definition) ).member(Pattern.ANY_STRING) ).toExpression(), "clone" ).invoke(), astBuilder.convertType(definition) ).member(Pattern.ANY_STRING) ).toExpression(), "clone" ).invoke()
astBuilder.convertType(definition) ).member(Pattern.ANY_STRING) ).toExpression(), "clone" ).invoke(), astBuilder.convertType(definition) ).member(Pattern.ANY_STRING) ).toExpression(), "clone" ).invoke()
new AssignmentExpression( new IdentifierExpressionBackReference("savedException").toExpression(), new NamedNode("caughtException", new IdentifierExpression(Expression.MYSTERY_OFFSET, Pattern.ANY_STRING)).toExpression() new IdentifierExpressionBackReference("savedException").toExpression().invoke( "addSuppressed", new NamedNode("caughtOnClose", new IdentifierExpression(Expression.MYSTERY_OFFSET, Pattern.ANY_STRING)).toExpression()
new AssignmentExpression( new IdentifierExpressionBackReference("savedException").toExpression(), new NamedNode("caughtException", new IdentifierExpression(Expression.MYSTERY_OFFSET, Pattern.ANY_STRING)).toExpression() new IdentifierExpressionBackReference("savedException").toExpression().invoke( "addSuppressed", new NamedNode("caughtOnClose", new IdentifierExpression(Expression.MYSTERY_OFFSET, Pattern.ANY_STRING)).toExpression()
new AssignmentExpression( new IdentifierExpressionBackReference("savedException").toExpression(), new NamedNode("caughtException", new IdentifierExpression(Expression.MYSTERY_OFFSET, Pattern.ANY_STRING)).toExpression() new IdentifierExpressionBackReference("savedException").toExpression().invoke( "addSuppressed", new NamedNode("caughtOnClose", new IdentifierExpression(Expression.MYSTERY_OFFSET, Pattern.ANY_STRING)).toExpression()