You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2019/01/12 02:06:00 UTC
[jira] [Updated] (GROOVY-8955) VerifyError when AIC with @CS can't
be detected as not valid
[ https://issues.apache.org/jira/browse/GROOVY-8955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-8955:
------------------------------
Description:
In this buggy code the return type of {{getMappedForm}} method in the AIC should be property. None-the-less, it shouldn't result in a {{VerifyError}}:
{code}
import groovy.transform.CompileStatic
class Property {
String generator
}
public interface PMapping<T extends Property> {
T getMappedForm();
}
public interface PProperty {
PMapping getMapping();
}
@CompileStatic
class GPEntity {
def method() {
PProperty identity = getIdentity()
String generatorType = identity.getMapping().getMappedForm().getGenerator()
}
PProperty getIdentity() {
new PProperty() {
PMapping getMapping() {
new PMapping() {
def getMappedForm() {
new Property() {
String getGenerator() { 'foo' }
}
}
}
}
}
}
}
new GPEntity().method()
{code}
The error is:
{noformat}
java.lang.VerifyError: Bad return type
Exception Details:
Location:
GPEntity$1$2.getMappedForm()LProperty; @4: areturn
Reason:
Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'Property' (from method signature)
Current Frame:
bci: @4
flags: { }
locals: { 'GPEntity$1$2' }
stack: { 'java/lang/Object' }
Bytecode:
0x0000000: 2ab6 0099 b0
at GPEntity$1.getMapping(ConsoleScript13:25)
...
{noformat}
was:
In this buggy code the return type of {{getMappedForm}} method in the AIC should be property. None-the-less, it shouldn't result in a {{VerifyError}}:
{code}
import groovy.transform.CompileStatic
class Property {
String generator
}
public interface PMapping<T extends Property> {
T getMappedForm();
}
public interface PProperty {
PMapping getMapping();
}
@CompileStatic
class GPEntity {
def method() {
PProperty identity = getIdentity()
String generatorType = identity.getMapping().getMappedForm().getGenerator()
}
PProperty getIdentity() {
new PProperty() {
PMapping getMapping() {
new PMapping() {
def getMappedForm() {
new Property() {
String getGenerator() { 'foo' }
}
}
}
}
}
}
}
new GPEntity().method()
{code}
> VerifyError when AIC with @CS can't be detected as not valid
> ------------------------------------------------------------
>
> Key: GROOVY-8955
> URL: https://issues.apache.org/jira/browse/GROOVY-8955
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Priority: Major
>
> In this buggy code the return type of {{getMappedForm}} method in the AIC should be property. None-the-less, it shouldn't result in a {{VerifyError}}:
> {code}
> import groovy.transform.CompileStatic
> class Property {
> String generator
> }
> public interface PMapping<T extends Property> {
> T getMappedForm();
> }
> public interface PProperty {
> PMapping getMapping();
> }
> @CompileStatic
> class GPEntity {
> def method() {
> PProperty identity = getIdentity()
> String generatorType = identity.getMapping().getMappedForm().getGenerator()
> }
> PProperty getIdentity() {
> new PProperty() {
> PMapping getMapping() {
> new PMapping() {
> def getMappedForm() {
> new Property() {
> String getGenerator() { 'foo' }
> }
> }
> }
> }
> }
> }
> }
> new GPEntity().method()
> {code}
> The error is:
> {noformat}
> java.lang.VerifyError: Bad return type
> Exception Details:
> Location:
> GPEntity$1$2.getMappedForm()LProperty; @4: areturn
> Reason:
> Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'Property' (from method signature)
> Current Frame:
> bci: @4
> flags: { }
> locals: { 'GPEntity$1$2' }
> stack: { 'java/lang/Object' }
> Bytecode:
> 0x0000000: 2ab6 0099 b0
> at GPEntity$1.getMapping(ConsoleScript13:25)
> ...
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)