alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (CompiledAtIntegrationTest.groovy)

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

compiledatasttransformation, compiledatasttransformation, myclass, myclass, transformtesthelper, transformtesthelper

The Groovy CompiledAtIntegrationTest.groovy source code

import transforms.global.CompiledAtASTTransformation 
import org.codehaus.groovy.ast.*
import org.codehaus.groovy.transform.*
import org.codehaus.groovy.control.*
import org.codehaus.groovy.tools.ast.*

/**
* This shows how to use the TransformTestHelper to test
* a global transformation. It is a little hard to invoke 
* because the CompiledAtASTTransformation must be on the 
* classpath but the JAR containing the transform must not
* or the transform gets applied twice. 
*
* @author Hamlet D'Arcy
*/ 
def transform = new CompiledAtASTTransformation()
def phase = CompilePhase.CONVERSION
def helper = new TransformTestHelper(transform, phase)
def clazz = helper.parse(' class MyClass {} ' )
assert clazz.getCompiledTime() != null
println 'compiled at' + clazz.getCompiledTime()

Other Groovy examples (source code examples)

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

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

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
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.