flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Hogan (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (FLINK-5070) Unable to use Scala's BeanProperty with classes
Date Tue, 09 May 2017 18:54:04 GMT

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

Greg Hogan closed FLINK-5070.
-----------------------------
    Resolution: Fixed

master: c90b6da5ff845e55c52150a3c6f0b7192959a40e
release-1.3: 949d16e8a00656fa1ee1b235c8ca704331b09f55

> Unable to use Scala's BeanProperty with classes
> -----------------------------------------------
>
>                 Key: FLINK-5070
>                 URL: https://issues.apache.org/jira/browse/FLINK-5070
>             Project: Flink
>          Issue Type: Bug
>          Components: Core, Scala API, Type Serialization System
>    Affects Versions: 1.1.3
>            Reporter: Jakub Nowacki
>            Assignee: Timo Walther
>             Fix For: 1.3.0, 1.4.0
>
>
> When using Scala class with with property (both var and val) annotated as BeanProperty,
throws an exception {{java.lang.IllegalStateException: Detected more than one getter}}.
> The simple code which follows throws that exception:
> {code:java}
> class SomeClass(@BeanProperty var prop: Int)
> object SampleBeanProperty {
>     def main(args: Array[String]): Unit = {
>         val env = StreamExecutionEnvironment.createLocalEnvironment()
>         // Create a DataSet from a list of elements
>         env.fromElements(1,2)
>             .map(new SomeClass(_))
>             .print
>         env.execute()
>     }
> }
> {code}
> Full exception:
> {code}
> Exception in thread "main" java.lang.IllegalStateException: Detected more than one setter
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.isValidPojoField(TypeExtractor.java:1646)
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.analyzePojo(TypeExtractor.java:1692)
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.privateGetForClass(TypeExtractor.java:1580)
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.privateGetForClass(TypeExtractor.java:1479)
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.createTypeInfoWithTypeHierarchy(TypeExtractor.java:737)
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.privateCreateTypeInfo(TypeExtractor.java:543)
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.createTypeInfo(TypeExtractor.java:497)
> 	at org.apache.flink.api.java.typeutils.TypeExtractor.createTypeInfo(TypeExtractor.java:493)
> 	at SampleBeanProperty$.main(SampleBeanProperty.scala:18)
> 	at SampleBeanProperty.main(SampleBeanProperty.scala)
> 	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:498)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
> {code}
> If the class is changed into case class, code with BeanProperty works fine.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message