home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (LineColumnCheck.txt)

This example Groovy source code file (LineColumnCheck.txt) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

annotation, bean, blockstatement,, classnode,, classnode,, constantexpression,, constantexpression,, expressionstatement,, genericstype,, io, methodcallexpression,, propertyexpression,, string, string, util, variableexpression,, variableexpression,

The Groovy LineColumnCheck.txt source code

###wholeAnnotationExpressionSelection:::
import java.lang.annotation.*
@Target([ElementType.TYPE])
class A {}
:::[AnnotationNode,(2:1),(2:28)]

###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)]

###ifelse:::
if (expression) {
	
} else {
	
}
:::[IfStatement,(1:1),(5:2)];[BlockStatement,(1:17),(3:3)];
[BlockStatement,(3:8),(5:2)]

###ifwithoutElse:::
if (expression) {
	
	
}
:::[IfStatement,(1:1),(4:2)];[BlockStatement,(1:17),(4:2)]

###ifElseif:::
if (expression) {

	
} else if (expression2) {


}
:::[IfStatement,(1:1),(7:2)];[BlockStatement,(1:17),(4:3)];
[IfStatement,(4:8),(7:2)];[BlockStatement,(4:25),(7: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)]

###tryCatch:::
try {
	
} catch(e) {
	
	
}
:::[TryCatchStatement,(1:1),(6:2)][BlockStatement,(1:5),(3:3)];
[CatchStatement,(3:3),(6:2)][BlockStatement,(3:12),(6:2)]

###tryFinally:::
try {

	
} finally {

}
:::[TryCatchStatement,(1:1),(6:2)][BlockStatement,(1:5),(4:3)];
[BlockStatement,(4:3),(6:2)][BlockStatement,(4:11),(6:2)]

###tryCatchFinally():::
try {

} catch(e) {

} finally {

}
:::[TryCatchStatement,(1:1),(7:2)][BlockStatement,(1:5),(3:3)];
[CatchStatement,(3:3),(5:3)][BlockStatement,(3:12),(5:3)];
[BlockStatement,(5:3),(7:2)][BlockStatement,(5:11),(7:2)]

###tryMultiCatchFinally:::
try {

} catch(e) {
	
} catch(e) {
	
} finally {
	
}
:::[TryCatchStatement,(1:1),(9:2)][BlockStatement,(1:5),(3:3)];
[CatchStatement,(3:3),(5:3)][BlockStatement,(3:12),(5:3)];
[CatchStatement,(5:3),(7:3)][BlockStatement,(5:12),(7:3)];
[BlockStatement,(7:3),(9:2)][BlockStatement,(7:11),(9:2)]

###switchCase:::
switch (expression) {
	case 1 : log = 1
	case 2 : log = 2
}
:::[SwitchStatement,(1:1),(4:2)];
[CaseStatement,(2:2),(2:6)];[BlockStatement,(2:11),(3:2)];
[CaseStatement,(3:2),(3:6)];[BlockStatement,(3:11),(4:1)]

###switchCaseDefault:::
switch (expression) {
	case 1 : log = 1 ; break
	case 2 : log = 2 ; break
	default : log = 6
}
:::[SwitchStatement,(1:1),(5:2)];
[CaseStatement,(2:2),(2:6)];[BlockStatement,(2:11),(3:2)];[BreakStatement,(2:21),(2:26)];
[CaseStatement,(3:2),(3:6)];[BlockStatement,(3:11),(4:2)];[BreakStatement,(3:21),(3:26)];
[BlockStatement,(4:12),(5:1)]

###synchronizedStatement:::
synchronized (obj) {


}
:::[SynchronizedStatement,(1:1),(4:2)];[BlockStatement,(1:20),(4:2)]

###breakStatement:::
break label
:::[BreakStatement,(1:1),(1:12)]

###continueStatement:::
continue label
:::[ContinueStatement,(1:1),(1:15)]

###assertStatement():::
assert (expression)
:::[AssertStatement,(1:1),(1:20)]

###assertStatementAdv:::
assert (expression) , "AssertTest"
:::[AssertStatement,(1:1),(1:35)][BooleanExpression,(1:8),(1:21)];
[VariableExpression,(1:8),(1:21)][ConstantExpression,(1:23),(1:35)]

###throwStatement:::
throw new Exception("exception")
:::[ThrowStatement,(1:1),(1:33)][ConstructorCallExpression,(1:7),(1:33)];
[ArgumentListExpression,(1:21),(1:32)][ConstantExpression,(1:21),(1:32)]

###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)]

###methodCallExpressionInAssignment:::
sub = "groovy".substring(3)
:::[MethodCallExpression,(1:7),(1:28)][ConstantExpression,(1:7),(1:15)];
[ConstantExpression,(1:16),(1:25)][ArgumentListExpression,(1:26),(1:27)];
[ConstantExpression,(1:26),(1:27)]

###constructorCallExpressionInAssignment:::
txt = new String("groovy")
:::[ConstructorCallExpression,(1:7),(1:27)][ClassNode,(1:11),(1:17)][ArgumentListExpression,(1:18),(1:26)];
[ConstantExpression,(1:18),(1:26)]

###methodCallExpressionAppendedBlockInAssignment:::
var = f{closure}
:::[MethodCallExpression,(1:7),(1:17)];
[ConstantExpression,(1:7),(1:8)][ArgumentListExpression,(1:8),(1:17)][ClosureExpression,(1:8),(1:17)]

###methodCallExpressionArgsAndAppendedBlock:::
a = f(x){y}
:::[MethodCallExpression,(1:5),(1:12)];
[ConstantExpression,(1:5),(1:6)][ArgumentListExpression,(1:7),(1:8)][VariableExpression,(1:7),(1:8)];
[ClosureExpression,(1:9),(1:12)]

###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)]

###methodCallExpressionChain:::
b = getClass().getName().substring(42)
:::[MethodCallExpression,(1:5),(1:39)][MethodCallExpression,(1:5),(1:25)];
[MethodCallExpression,(1:5),(1:15)];
[ConstantExpression,(1:5),(1:13)][ArgumentListExpression,(1:14),(1:14)];
[ConstantExpression,(1:16),(1:23)][ArgumentListExpression,(1:24),(1:24)];
[ConstantExpression,(1:26),(1:35)][ArgumentListExpression,(1:36),(1:38)];
[ConstantExpression,(1:36),(1:38)]

###methodCallExpressionNested:::
b = outerMethod(obj.innerMethod(abc))
:::[MethodCallExpression,(1:5),(1:38)];
[ConstantExpression,(1:5),(1:16)][ArgumentListExpression,(1:17),(1:37)];
[MethodCallExpression,(1:17),(1:37)][VariableExpression,(1:17),(1:20)];
[ConstantExpression,(1:21),(1:32)][ArgumentListExpression,(1:33),(1:36)];
[VariableExpression,(1:33),(1:36)]

###indexPropertyArgsWithObj:::
a = obj.prop[]
:::[BinaryExpression,(1:5),(1:15)]

###indexPropertyArgsNoObj:::
a = obj['prop']
:::[BinaryExpression,(1:5),(1:16)]

###declaratorBracketD1:::
int[] array
:::[ExpressionStatement,(1:1),(1:12)][ClassNode,(1:1),(1:7)][DeclarationExpression,(1:1),(1:12)]

###declaratorBracketD3:::
int[][][] array
:::[ExpressionStatement,(1:1),(1:16)][ClassNode,(1:1),(1:11)][DeclarationExpression,(1:1),(1:16)]

###resolvedDeclarationExpression:::
def i = Integer.parseInt("42")
:::[DeclarationExpression,(1:1),(1:31)]

###throwsClauseName:::
def method() throws Exception {}
:::[ClassNode,(1:21),(1:30)]

###throwsClauseQualifiedName:::
def method() throws java.lang.Exception {}
:::[ClassNode,(1:21),(1:41)]

###throwsClauseMultiQualifiedName:::
def method() throws java.lang.Exception, java.lang.RuntimeException {}
:::[ClassNode,(1:21),(1:40)][ClassNode,(1:42),(1:69)]

###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:1),(1:20)]

###importStatementAliased:::
import java.util.ArrayList as MyList
:::[ClassNode,(1:1),(1:37)]

###staticImportStatementStar:::
import static java.lang.Math.*
:::[ClassNode,(1:1),(1:31)]

###staticImportStatementAliases:::
import static java.lang.Math.cos
:::[ClassNode,(1:1),(1:33)]

###declarationWithFullQualifiedTypeName:::
java.lang.String s = "Groovy"
:::[ClassNode,(1:1),(1:18)][DeclarationExpression,(1:1),(1:30)][VariableExpression,(1:18),(1:19)]

###typeArgument:::
Map<String,Object> map
:::[ClassNode,(1:1),(1:4)];
[GenericsType,(1:5),(1:11)][ClassNode,(1:5),(1:11)];
[GenericsType,(1:12),(1:18)][ClassNode,(1:12),(1:18)]

###typeArgumentFullQualifiedTypeName:::
Map<java.lang.String,java.lang.Object> map
:::[ClassNode,(1:1),(1:4)][GenericsType,(1:5),(1:21)][ClassNode,(1:5),(1:21)];
[GenericsType,(1:22),(1:38)][ClassNode,(1:22),(1:38)]

###typeArgumentUpperBound:::
Collection<? extends File> c
:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:26)][ClassNode,(-1:-1),(-1:-1)];
[ClassNode,(1:22),(1:26)]

###typeArgumentLowerBound:::
Collection<? super File> c
:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:24)][ClassNode,(-1:-1),(-1:-1)];
[ClassNode,(1:20),(1:24)]

###typeArgumentsLowerAndUpperBound:::
Collection<? extends String,? super File> c
:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:28)][ClassNode,(-1:-1),(-1:-1)][ClassNode,(1:22),(1:28)];
[GenericsType,(1:29),(1:41)][ClassNode,(-1:-1),(-1:-1)][ClassNode,(1:37),(1:41)]

###typeArgumentNested:::
class C<Y,T extends Map> {}
:::[ClassNode,(1:1),(1:51)][GenericsType,(1:9),(1:10)][ClassNode,(1:9),(1:10)];
[GenericsType,(1:11),(1:49)][ClassNode,(1:11),(1:12)][ClassNode,(1:21),(1:49)];
[GenericsType,(1:25),(1:31)][ClassNode,(1:25),(1:31)][GenericsType,(1:32),(1:49)][ClassNode,(1:32),(1:35)];
[GenericsType,(1:36),(1:37)][ClassNode,(1:36),(1:37)][GenericsType,(1:38),(1:45)][ClassNode,(1:38),(1:45)]

###typeArugmentInConstructorCall:::
ArrayList<String> list = new ArrayList()
:::[ClassNode,(1:30),(1:39)][GenericsType,(1:40),(1:46)][ClassNode,(1:40),(1:46)]

###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)]

###PropertyExpressionStaticField:::
class PropertyExpression {
    static field
    static method() {
        PropertyExpression.field = 42
    }
}
:::[PropertyExpression,(4:9),(4:34)]

###PropertyExpressionNormal:::
class TestClass {
    TestClass prop
}
TestClass.prop.prop = 42
:::[PropertyExpression,(4:1),(4:21)][PropertyExpression,(4:1),(4:15)]

###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 vlaue = 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)]

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy LineColumnCheck.txt source code file:

new blog posts

 

Copyright 1998-2013 Alvin Alexander, alvinalexander.com
All Rights Reserved.