[ 
https://issues.apache.org/jira/browse/AVRO-1703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15287288#comment-15287288
 ] 

Trent Altman commented on AVRO-1703:
------------------------------------

I have a patch for this that I use 
https://github.com/defg/avro/commit/cfd900b464e18696d2afa1d3d7794ddbef37e738

I'm happy to finish the work on this for contributing if there is interest and 
someone can point me to what else needs to be done.

> Specific record should not only be determined by presence of SCHEMA$ field
> --------------------------------------------------------------------------
>
>                 Key: AVRO-1703
>                 URL: https://issues.apache.org/jira/browse/AVRO-1703
>             Project: Avro
>          Issue Type: Improvement
>            Reporter: Marius Soutier
>              Labels: starter
>
> I want to use Avro from Scala, i.e. generate case classes from an Avro 
> schema. So far this is working fine except for one thing - fields in Scala 
> classes are always private. This doesn't work with Avro SpecificRecords (at 
> least when inferring the schema from the class) and results in the following 
> exception:
> org.apache.avro.AvroRuntimeException: java.lang.IllegalAccessException: Class 
> org.apache.avro.specific.SpecificData can not access a member of class 
> <my.Class> with modifiers "private"
> The exception is thrown from the following line in 
> org.apache.avro.specific.SpecificData:
> schema = (Schema)(c.getDeclaredField("SCHEMA$").get(null));
> My suggestion would be to additionally check for a method called `getSchema` 
> and read the schema from that method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to