|
Groovy example source code file (Groovy3776Bug.groovy)
The Groovy Groovy3776Bug.groovy source codepackage groovy.bugs import java.lang.reflect.* import org.codehaus.groovy.control.MultipleCompilationErrorsException import org.codehaus.groovy.GroovyBugError class Groovy3776Bug extends GroovyTestCase { void testInvalidListWithMapEntryExpressions() { GroovyClassLoader cl = new GroovyClassLoader(); def scriptStr = """ class InvalidListLiteral { def x = [ [foo: 1, bar: 2] [foo: 1, bar: 2] ] } """ try { cl.parseClass(scriptStr) fail('Compilation should have failed with MultipleCompilationErrorsException') } catch(MultipleCompilationErrorsException mcee) { // ok if failed with this error. } catch(GroovyBugError gbe) { fail('Compilation should have failed with MultipleCompilationErrorsException but failed with GroovyBugError') } } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy Groovy3776Bug.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 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.