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

Groovy example source code file (Groovy1462_Bug.groovy)

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

Java - Groovy tags/keywords

groovy1462_bug, groovy1462_bug, groovytestcase, groovytestcase, integer, integer, stringmethodname, stringmethodname

The Groovy Groovy1462_Bug.groovy source code

package groovy.bugs

 *  Verifies that the Groovy parser can accept quoted methods.

class Groovy1462_Bug extends GroovyTestCase {
    void testShort() {
        def smn = new StringMethodName()
        assert smn.foo0() == 'foo0'
        assert smn.'foo0'() == 'foo0'
        assert smn.foo1() == 'foo1'
        assert smn.'foo1'() == 'foo1'
        assert smn.foo2() == 2
        assert smn.foo3() == 3
        assert smn.foo4(3) == 12
        assert smn.foo5 == 'foo5'
        assert !smn.fooFalse()
        assert smn.fooDef() == null

class StringMethodName {
    def foo0() {'foo0'} // control
    def 'foo1'() {'foo1'}
    public Integer 'foo2'() {2}
    public int 'foo3'() {3}
    Integer 'foo4'(x) { x * 4}
    public def 'getFoo5'() {'foo5'}
    private boolean 'fooFalse'() {false}
    public def 'fooDef'() {}

Other Groovy examples (source code examples)

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

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.