Skip to content

Instantly share code, notes, and snippets.

@dwarszawski
Created July 21, 2016 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwarszawski/41aed2cf53486a5603447f54a44b4ac3 to your computer and use it in GitHub Desktop.
Save dwarszawski/41aed2cf53486a5603447f54a44b4ac3 to your computer and use it in GitHub Desktop.
Result: STARTED
groovy.lang.MissingPropertyException: No such property: foo for class: Foo
at groovy.lang.MetaClassImpl.invokeStaticMissingProperty(MetaClassImpl.java:1001)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1856)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1832)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3734)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:175)
at groovy.lang.Closure.getPropertyTryThese(Closure.java:324)
at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:318)
at groovy.lang.Closure.getProperty(Closure.java:307)
at Foo$_bar_closure1.doCall(ideaGroovyConsole.groovy:14)
at Foo$_bar_closure1.call(ideaGroovyConsole.groovy)
at org.codehaus.groovy.runtime.StringGroovyMethods.collectReplacements(StringGroovyMethods.java:661)
at Foo.bar(ideaGroovyConsole.groovy:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at ideaGroovyConsole.run(ideaGroovyConsole.groovy:22)
at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
at groovy.lang.GroovyShell.run(GroovyShell.java:518)
at groovy.lang.GroovyShell.run(GroovyShell.java:497)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:169)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at console.run(console.txt:25)
at groovy.ui.GroovyMain.processReader(GroovyMain.java:631)
at groovy.ui.GroovyMain.processFiles(GroovyMain.java:539)
at groovy.ui.GroovyMain.run(GroovyMain.java:382)
at groovy.ui.GroovyMain.process(GroovyMain.java:370)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
at groovy.ui.GroovyMain.main(GroovyMain.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:46)
import groovy.transform.CompileStatic
@CompileStatic
class Foo {
private final List<String> foo
Foo(List<String> foo) {
this.foo = foo
}
private static String bar() {
String foobar = "foobar"
return foobar.collectReplacements {
return ((it as String) in foo) ? 'o' : null
}
}
}
println("STARTED")
Foo o1 = new Foo(["a", "b", "c"])
println(o1.bar())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment