[jira] [Updated] (GROOVY-8938) Final field caching issues in inherited field.

2018-12-24 Thread Anton Pryamostanov (JIRA)


 [ 
https://issues.apache.org/jira/browse/GROOVY-8938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anton Pryamostanov updated GROOVY-8938:
---
Priority: Critical  (was: Major)

> Final field caching issues in inherited field.
> --
>
> Key: GROOVY-8938
> URL: https://issues.apache.org/jira/browse/GROOVY-8938
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.5.4
>Reporter: Anton Pryamostanov
>Priority: Critical
>
> Note: **this seems to be a quite major issue**, kindly look at this one with 
> emphasis.
> Please see the below test case:
> SubClass extends the SuperClass and overrides the field "inheritedField".
> {code}
> class OtherClass {
> String otherField
> OtherClass(String otherField) {
> this.otherField = otherField
> }
> String toString() {
> return otherField
> }
> }
> class SuperClass {
> final OtherClass inheritedField = new OtherClass("Super Class String")
> }
> class SubClass extends SuperClass {
> final OtherClass inheritedField = new OtherClass("Sub Class String")
> }
> SuperClass superClass = new SuperClass()
> SubClass subClass = new SubClass()
> assert subClass.inheritedField.toString() == "Sub Class String"
> {code}
> Actual result: assertion fails
> Expected result: assertion should pass
> Note: If "final" modifier is removed, assertion passes as expected.
> This seems an issue with final field caching.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (GROOVY-8938) Final field caching issues in inherited field.

2018-12-24 Thread Anton Pryamostanov (JIRA)


 [ 
https://issues.apache.org/jira/browse/GROOVY-8938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anton Pryamostanov updated GROOVY-8938:
---
Description: 
Note: **this seems to be a quite major issue**, kindly look at this one with 
emphasis.

Please see the below test case:
SubClass extends the SuperClass and overrides the field "inheritedField".
{code}
class OtherClass {
String otherField
OtherClass(String otherField) {
this.otherField = otherField
}
String toString() {
return otherField
}
}
class SuperClass {
final OtherClass inheritedField = new OtherClass("Super Class String")
}
class SubClass extends SuperClass {
final OtherClass inheritedField = new OtherClass("Sub Class String")
}
SuperClass superClass = new SuperClass()
SubClass subClass = new SubClass()
assert subClass.inheritedField.toString() == "Sub Class String"
{code}

*Actual result*: assertion fails
*Expected result*: assertion should pass
*Note*: If "final" modifier is removed, assertion passes as expected.
This seems an issue with final field caching.

Assertion error text:
{code}
Assertion failed: 
assert subClass.inheritedField.toString() == "Sub Class String"
   ||  |  |
   ||  |  false
   ||  'Super Class String'
   |Super Class String
   SubClass@5b4b841f
at ConsoleScript11.run(ConsoleScript11:18)
{code}

  was:
Note: **this seems to be a quite major issue**, kindly look at this one with 
emphasis.

Please see the below test case:
SubClass extends the SuperClass and overrides the field "inheritedField".
{code}
class OtherClass {
String otherField
OtherClass(String otherField) {
this.otherField = otherField
}
String toString() {
return otherField
}
}
class SuperClass {
final OtherClass inheritedField = new OtherClass("Super Class String")
}
class SubClass extends SuperClass {
final OtherClass inheritedField = new OtherClass("Sub Class String")
}
SuperClass superClass = new SuperClass()
SubClass subClass = new SubClass()
assert subClass.inheritedField.toString() == "Sub Class String"
{code}

Actual result: assertion fails
Expected result: assertion should pass
Note: If "final" modifier is removed, assertion passes as expected.
This seems an issue with final field caching.


> Final field caching issues in inherited field.
> --
>
> Key: GROOVY-8938
> URL: https://issues.apache.org/jira/browse/GROOVY-8938
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.5.4
>Reporter: Anton Pryamostanov
>Priority: Critical
>
> Note: **this seems to be a quite major issue**, kindly look at this one with 
> emphasis.
> Please see the below test case:
> SubClass extends the SuperClass and overrides the field "inheritedField".
> {code}
> class OtherClass {
> String otherField
> OtherClass(String otherField) {
> this.otherField = otherField
> }
> String toString() {
> return otherField
> }
> }
> class SuperClass {
> final OtherClass inheritedField = new OtherClass("Super Class String")
> }
> class SubClass extends SuperClass {
> final OtherClass inheritedField = new OtherClass("Sub Class String")
> }
> SuperClass superClass = new SuperClass()
> SubClass subClass = new SubClass()
> assert subClass.inheritedField.toString() == "Sub Class String"
> {code}
> *Actual result*: assertion fails
> *Expected result*: assertion should pass
> *Note*: If "final" modifier is removed, assertion passes as expected.
> This seems an issue with final field caching.
> Assertion error text:
> {code}
> Assertion failed: 
> assert subClass.inheritedField.toString() == "Sub Class String"
>||  |  |
>||  |  false
>||  'Super Class String'
>|Super Class String
>SubClass@5b4b841f
>   at ConsoleScript11.run(ConsoleScript11:18)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)