| ==== |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| ==== |
| |
| ###FieldNode::: |
| public class Test { |
| public attribute = 6, second = 9 |
| String prop = "property" |
| } |
| :::[FieldNode,(2:2),(2:22)][ConstantExpression,(2:21),(2:22)]; |
| [FieldNode,(2:24),(2:34)][ConstantExpression,(2:33),(2:34)]; |
| [FieldNode,(3:2),(3:26)][ConstantExpression,(3:16),(3:26)] |
| |
| ###PropertyNode::: |
| class Test { |
| String first = 'xyzzy' |
| String second |
| @Deprecated String third |
| private String fourth = 'split before' |
| String fourth |
| String fifth |
| private String fifth = 'split after' |
| } |
| :::[FieldNode,(2:2),(2:24)][ConstantExpression,(2:17),(2:24)]; |
| [FieldNode,(3:2),(3:15)]; |
| [FieldNode,(4:2),(4:26)]; |
| [FieldNode,(5:2),(5:40)][ConstantExpression,(5:26),(5:40)]; |
| [FieldNode,(8:2),(8:38)][ConstantExpression,(8:25),(8:38)] |
| |
| ###wholeAnnotationExpressionSelection::: |
| import java.lang.annotation.* |
| @Target([ElementType.TYPE]) |
| class A {} |
| :::[AnnotationNode,(2:1),(2:28)] |
| |
| ###ifWithoutElse::: |
| if (expression) { |
| |
| |
| } |
| :::[IfStatement,(1:1),(4:2)];[BlockStatement,(1:17),(4:2)] |
| |
| ###ifNested::: |
| if (expression) { |
| |
| if (expression2) { |
| |
| } |
| } |
| :::[IfStatement,(1:1),(6:2)];[BlockStatement,(1:17),(6:2)]; |
| [IfStatement,(3:2),(5:3)];[BlockStatement,(3:19),(5:3)] |
| |
| ###whileLoop::: |
| while (expression) { |
| |
| |
| } |
| :::[WhileStatement,(1:1),(4:2)];[BlockStatement,(1:20),(4:2)] |
| |
| ###forLoopClosureList::: |
| for (int i = 0; i < 10; i++) { |
| |
| |
| } |
| :::[ForStatement,(1:1),(4:2)];[BlockStatement,(1:30),(4:2)] |
| |
| ###forLoopInClause::: |
| for (a in (1..42)) { |
| |
| |
| } |
| :::[ForStatement,(1:1),(4:2)];[BlockStatement,(1:20),(4:2)] |
| |
| ###synchronizedStatement::: |
| synchronized (obj) { |
| |
| |
| } |
| :::[SynchronizedStatement,(1:1),(4:2)];[BlockStatement,(1:20),(4:2)] |
| |
| ###breakStatement::: |
| while (true) { |
| break label |
| } |
| :::[BreakStatement,(2:3),(2:14)] |
| |
| ###continueStatement::: |
| while (true) { |
| continue label |
| } |
| :::[ContinueStatement,(2:3),(2:17)] |
| |
| ###assertStatement()::: |
| assert (expression) |
| :::[AssertStatement,(1:1),(1:20)] |
| |
| ###nonBracedStatementIf::: |
| if (expression) |
| while (expression2) |
| i++ |
| :::[IfStatement,(1:1),(3:6)];[WhileStatement,(2:2),(3:6)] |
| |
| ###nonBracedStatementWhile::: |
| while (expression) |
| if (expression2) |
| i++ |
| :::[WhileStatement,(1:1),(3:6)];[IfStatement,(2:2),(3:6)] |
| |
| ###nonBracedStatementfor::: |
| for (def i = 1; i < 42; i++) |
| if (expression) |
| k++ |
| :::[ForStatement,(1:1),(3:6)];[IfStatement,(2:2),(3:6)] |
| |
| ###oneLineMultiDef::: |
| Integer i = 0, j = 42, k = 6 |
| :::[ExpressionStatement,(1:1),(1:14)][ClassNode,(1:1),(1:8)][DeclarationExpression,(1:1),(1:14)]; |
| [VariableExpression,(1:9),(1:10)][ConstantExpression,(1:13),(1:14)]; |
| [ExpressionStatement,(1:16),(1:22)][ClassNode,(1:1),(1:8)][DeclarationExpression,(1:16),(1:22)]; |
| [VariableExpression,(1:16),(1:17)][ConstantExpression,(1:20),(1:22)]; |
| [ExpressionStatement,(1:24),(1:29)][ClassNode,(1:1),(1:8)][DeclarationExpression,(1:24),(1:29)]; |
| [VariableExpression,(1:24),(1:25)][ConstantExpression,(1:28),(1:29)] |
| |
| ###oneLineDef::: |
| Integer onLine = 42 |
| def ii = 17 |
| :::[ExpressionStatement,(1:1),(1:20)][ClassNode,(1:1),(1:8)][DeclarationExpression,(1:1),(1:20)]; |
| [VariableExpression,(1:9),(1:15)][ConstantExpression,(1:18),(1:20)]; |
| [ExpressionStatement,(2:1),(2:12)][ClassNode,(-1:-1),(-1:-1)][DeclarationExpression,(2:1),(2:12)]; |
| [VariableExpression,(2:5),(2:7)][ConstantExpression,(2:10),(2:12)] |
| |
| ###parenthisedExpressionVariable::: |
| myMap = [(key):value] |
| :::[VariableExpression,(1:10),(1:15)] |
| |
| ###parenthisedExpressionOperatorPreference::: |
| xy = (1 * (2 + 3)) |
| :::[BinaryExpression,(1:6),(1:19)];[BinaryExpression,(1:11),(1:18)] |
| |
| ###staticMethodCallFromStaticImport::: |
| import static java.lang.Math.* |
| cos(42) |
| :::[StaticMethodCallExpression,(2:1),(2:8)] |
| |
| ###staticMethodCall::: |
| class Test { |
| def static main() { |
| execute() |
| } |
| def static execute() { |
| } |
| }:::[StaticMethodCallExpression,(3:3),(3:12)] |
| |
| ###methodCallExpressionAppendedBlockInAssignment::: |
| var = f{closure} |
| :::[MethodCallExpression,(1:7),(1:17)]; |
| [ConstantExpression,(1:7),(1:8)][ArgumentListExpression,(1:8),(1:17)][ClosureExpression,(1:8),(1:17)] |
| |
| |
| ###closureExpressionWithEmptyBlockStatement::: |
| f{ |
| |
| } |
| :::[MethodCallExpression,(1:1),(3:2)]; |
| [ConstantExpression,(1:1),(1:2)][ArgumentListExpression,(1:2),(3:2)][ClosureExpression,(1:2),(3:2)][BlockStatement,(1:2),(3:2)] |
| |
| ###ArrayExpressionD1::: |
| def array = new int[1] |
| :::[ArrayExpression,(1:13),(1:23)][ClassNode,(1:17),(1:20)][ConstantExpression,(1:21),(1:22)] |
| |
| ###ArrayExpressionD2::: |
| def array = new int[1][2] |
| :::[ArrayExpression,(1:13),(1:26)][ClassNode,(1:17),(1:20)]; |
| [ConstantExpression,(1:21),(1:22)][ConstantExpression,(1:24),(1:25)] |
| |
| ###indexPropertyArgsWithObj::: |
| a = obj.prop[] |
| :::[BinaryExpression,(1:5),(1:15)] |
| |
| ###indexPropertyArgsNoObj::: |
| a = obj['prop'] |
| :::[BinaryExpression,(1:5),(1:16)] |
| |
| ###resolvedDeclarationExpression::: |
| def i = Integer.parseInt("42") |
| :::[DeclarationExpression,(1:1),(1:31)] |
| |
| ###throwsClauseName::: |
| def method() throws Exception {} |
| :::[ClassNode,(1:21),(1:30)] |
| |
| ###extendsClassNode::: |
| class BaseClass {} |
| class ExtendedBaseClass extends BaseClass {} |
| :::[ClassNode,(2:33),(2:42)] |
| |
| ###implementsClassNode1::: |
| interface IBase {} |
| class BaseClass implements IBase {} |
| :::[ClassNode,(2:28),(2:33)] |
| |
| ###implementsClassNode3::: |
| interface IBase1 {} |
| interface IBase2 {} |
| interface IBase3 {} |
| class BaseClass implements IBase1, IBase2, IBase3 {} |
| :::[ClassNode,(4:28),(4:34)][ClassNode,(4:36),(4:42)][ClassNode,(4:44),(4:50)] |
| |
| ###importStatement::: |
| import java.io.File |
| :::[ClassNode,(1:8),(1:20)] |
| |
| ###importStatementAliased::: |
| import java.util.ArrayList as MyList |
| :::[ClassNode,(1:8),(1:27)] |
| |
| ###staticImportStatementStar::: |
| import static java.lang.Math.* |
| :::[ClassNode,(1:15),(1:29)] |
| |
| ###staticImportStatementName::: |
| import static java.lang.Math.cos |
| :::[ClassNode,(1:15),(1:29)] |
| |
| ###staticImportStatementAliased::: |
| import static java.lang.Math.cos as cosine |
| :::[ClassNode,(1:15),(1:29)] |
| |
| ###castExpressionClassNode::: |
| String s = (String)i |
| :::[ClassNode,(1:13),(1:19)] |
| |
| ###castExpressionFullQualifiedClassNode::: |
| String s = (java.lang.String)i |
| :::[ClassNode,(1:13),(1:29)] |
| |
| ###AsCastExpressionClassNode::: |
| String s = i as String |
| :::[ClassNode,(1:17),(1:23)] |
| |
| ###AsCastExpressionFullQualifiedClassNode::: |
| String s = i as java.lang.String |
| :::[ClassNode,(1:17),(1:33)] |
| |
| ###MethodPointerExpression::: |
| def selection = list.find (entry.&validate) |
| :::[MethodPointerExpression,(1:28),(1:43)][VariableExpression,(1:28),(1:33)][ConstantExpression,(1:35),(1:43)] |
| |
| ###Spread_DOT::: |
| def onlyAccess = list*.access |
| :::[PropertyExpression,(1:18),(1:30)][VariableExpression,(1:18),(1:22)][ConstantExpression,(1:24),(1:30)] |
| |
| ###Optional_DOT::: |
| def property = obj?.prop |
| :::[PropertyExpression,(1:16),(1:25)][VariableExpression,(1:16),(1:19)][ConstantExpression,(1:21),(1:25)] |
| |
| ###PropertyExpressionStaticImportClasses::: |
| import static java.lang.Math.* |
| def num = Math.PI |
| :::[PropertyExpression,(2:11),(2:18)][ClassExpression,(2:11),(2:15)][ConstantExpression,(2:16),(2:18)] |
| |
| ###PropertyExpressionStaticImportAliases::: |
| import static java.lang.Math.PI as PIPI |
| def num = Math.PIPI |
| :::[PropertyExpression,(2:11),(2:20)][ClassExpression,(2:11),(2:15)][ConstantExpression,(2:16),(2:20)] |
| |
| ###AttributeExpression1::: |
| class Bean { |
| public value |
| } |
| def bean = new Bean(value:42) |
| def value = bean.@value |
| :::[AttributeExpression,(5:13),(5:24)][VariableExpression,(5:13),(5:17)][ConstantExpression,(5:19),(5:24)] |
| |
| ###AttributeExpression2::: |
| class Bean { |
| public value |
| } |
| Bean bean = new Bean(value:42) |
| def attr = attributeAccess.@'value' |
| :::[AttributeExpression,(5:12),(5:36)][VariableExpression,(5:12),(5:27)][ConstantExpression,(5:29),(5:36)] |