[ https://issues.apache.org/jira/browse/GROOVY-7328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher closed GROOVY-7328. ------------------------------------- Resolution: Cannot Reproduce Closing this a, Cédric could not reproduce. Please reopen if you can post a self-contained example. > Base class setter chosen over private variable > ---------------------------------------------- > > Key: GROOVY-7328 > URL: https://issues.apache.org/jira/browse/GROOVY-7328 > Project: Groovy > Issue Type: Bug > Components: Android > Affects Versions: 2.4.0 > Reporter: Maciej Górski > Assignee: Cédric Champeau > Priority: Minor > > On Android, the following code crashes with exception: > Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: > Cannot cast object 'boom!' with class 'java.lang.String' to class 'int' > {code} > @CompileStatic > public final class HomeActivity extends ActionBarActivity { > private String result > @Override > protected void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState) > this.result = "boom!" > } > } > {code} > The reason is a base class declares `setResult` method: > http://developer.android.com/reference/android/app/Activity.html#setResult%28int%29 > Crash only happens when using > {{this.result = "boom!"}} > and not when > {{result = "boom!"}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)