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

Groovy example source code file (Groovy1018_Bug.groovy)

This example Groovy source code file (Groovy1018_Bug.groovy) 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

class, class, groovy1018_bug, groovy1018_bug, groovytestcase, groovytestcase, object, object

The Groovy Groovy1018_Bug.groovy source code

package groovy.bugs

/**
 * Test to fix the Jira issues GROOVY-1018 and GROOVY-732.
 * Access to a static field member by a class name:
 *      ClassName.fieldName or ClassName.@fieldName.
 *
 * @author Pilho Kim
 * @version $Revision: 2723 $
 */

class Groovy1018_Bug extends GroovyTestCase { 

    public static Object Class = "bar" 

    // todo: GROOVY-1018
    void testGetPublicStaticField() {
        def a = new Groovy1018_Bug()
        println( a.Class )
        println( a.@Class )
        println( Groovy1018_Bug.Class )
        println( Groovy1018_Bug.@Class )
        assert a.Class == "bar" && a.@Class == "bar"
        assert Groovy1018_Bug.Class == "bar" && Groovy1018_Bug.@Class == "bar"
    }

    // todo: GROOVY-732
    void testSetPublicStaticField() {
        Groovy1018_Bug.Class = 'bar-'
        assert Groovy1018_Bug.Class == "bar-" && Groovy1018_Bug.@Class == "bar-"
    }

} 

Other Groovy examples (source code examples)

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

new blog posts

 

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