Created
November 17, 2015 08:53
-
-
Save RomanSaveljev/bd651045b3631385066f to your computer and use it in GitHub Desktop.
Throws exception - reported to ASF JIRA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by romasave on 11/17/15. | |
*/ | |
class Main { | |
static abstract class Inner { | |
abstract int findA() | |
int doSomething() { | |
findA() | |
} | |
} | |
static abstract class A { | |
private int a = 7 | |
def inner = new Inner() { | |
@Override | |
int findA() { | |
return a | |
} | |
} | |
int doSomething() { | |
inner.doSomething() | |
} | |
abstract void toBeImplemented() | |
} | |
static class Factory { | |
A create() { | |
new A() { | |
@Override | |
void toBeImplemented() { | |
} | |
} | |
} | |
} | |
static void main(String[] args) { | |
//def a = new A() | |
//println a.doSomething() | |
Factory f = new Factory() | |
def aa = f.create() | |
println aa.doSomething() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ groovy bug.groovy | |
Caught: groovy.lang.MissingPropertyException: No such property: a for class: Main | |
groovy.lang.MissingPropertyException: No such property: a for class: Main | |
at Main$Factory.propertyMissing(bug.groovy) | |
at Main$Factory.getProperty(bug.groovy) | |
at Main$Factory.this$dist$get$1(bug.groovy) | |
at Main$Factory$1.propertyMissing(bug.groovy) | |
at Main$A.getProperty(bug.groovy) | |
at Main$A.this$dist$get$1(bug.groovy) | |
at Main$A$1.propertyMissing(bug.groovy) | |
at Main$Inner.getProperty(bug.groovy) | |
at Main$A$1.findA(bug.groovy:17) | |
at Main$Inner.doSomething(bug.groovy:9) | |
at Main$Inner$doSomething.call(Unknown Source) | |
at Main$A.doSomething(bug.groovy:21) | |
at Main$A$doSomething.call(Unknown Source) | |
at Main.main(bug.groovy:40) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
public class Main { | |
static abstract class Inner { | |
abstract int findA(); | |
int doSomething() { | |
return findA(); | |
} | |
} | |
static abstract class A { | |
private int a = 7; | |
private Inner inner = new Inner() { | |
@Override | |
int findA() { | |
return a; | |
} | |
}; | |
int doSomething() { | |
return inner.doSomething(); | |
} | |
abstract void toBeImplemented(); | |
} | |
static class Factory { | |
public A create() { | |
return new A() { | |
@Override | |
void toBeImplemented() { | |
} | |
}; | |
} | |
} | |
public static void main(String[] args) { | |
//def a = new A() | |
//println a.doSomething() | |
Factory f = new Factory(); | |
A aa = f.create(); | |
System.out.println(aa.doSomething()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment