[
https://issues.apache.org/jira/browse/AVRO-2796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17448796#comment-17448796
]
radai rosenblatt commented on AVRO-2796:
----------------------------------------
just wanted to shed some more light - the customDecode() method (introduced in
1.9+) bloats up to the point where it violates -
[https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-4.html#jvms-4.7.3] (a
java method can not have more than 64KByte of bytecode).
this happens under avro 1.9, 1.10 and 1.11
> Generated schema class can't be compiled: code too large
> --------------------------------------------------------
>
> Key: AVRO-2796
> URL: https://issues.apache.org/jira/browse/AVRO-2796
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.9.2
> Environment: {code:java}
> $ uname -a
> Linux barlnx 5.4.28-gentoo-PRI #1 SMP PREEMPT Mon Mar 30 19:39:16 EEST 2020
> x86_64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz GenuineIntel GNU/Linux{code}
> {code:java}
> $ java -version
> java version "1.8.0_202"
> Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
> Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode){code}
> Reporter: DMYTRO TRUNYKOV
> Priority: Major
> Attachments: record.avsc
>
>
> Hi,
> I have a schema (see the attach) that can be compiled into Java source code
> and then compiled by javac.
> This works for the AVRO release 1.8.2, but fails with the 1.9.2.
> Below are examples.
> Happy path (AVRO version 1.8.2):
> {code:java}
> $ java -jar avro-tools-1.8.2.jar compile -string schema record.avsc
> generated_sources/
> Input files to compile:
> record.avsc
> log4j:WARN No appenders could be found for logger (AvroVelocityLogChute).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more
> info.
> $ javac -cp avro-tools-1.8.2.jar generated_sources/example/avro/therecord.java
> $ tree generated_sources/
> generated_sources/
> └── example
> └── avro
> ├── therecord$1.class
> ├── therecord$Builder.class
> ├── therecord.class
> └── therecord.java
> {code}
>
> Unhappy path (AVRO version 1.9.2):
> {code:java}
> $ java -jar avro-tools-1.9.2.jar compile -string schema record.avsc
> generated_sources/
> Input files to compile:
> record.avsc
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key
> 'resource.loader' has been deprecated in favor of 'resource.loaders'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key
> 'class.resource.loader.class' has been deprecated in favor of 'resour
> ce.loader.class.class'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key
> 'file.resource.loader.class' has been deprecated in favor of 'resourc
> e.loader.file.class'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key
> 'file.resource.loader.path' has been deprecated in favor of 'resource
> .loader.file.path'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key
> 'runtime.references.strict' has been deprecated in favor of 'runtime.
> strict_mode.enable'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key
> 'space.gobbling' has been deprecated in favor of 'parser.space_gobbling'
> 20/04/12 13:51:27 WARN specific.SpecificCompiler: Record
> 'example.avro.therecord' contains more than 254 parameters which exceeds the
> JVM spec for the number of permitted constructor arguments. Clients must rely
> on the builder pattern to create objects instead. For more info see JIRA
> ticket AVRO-1642.
> $ javac -cp avro-tools-1.9.2.jar generated_sources/example/avro/therecord.java
> generated_sources/example/avro/therecord.java:24600: error: code too large
> private Builder(example.avro.therecord.Builder other) {
> ^
> generated_sources/example/avro/therecord.java:90993: error: code too large
> @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
> ^
> 2 errors
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)