[
https://issues.apache.org/jira/browse/AVRO-3116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ismaël Mejía updated AVRO-3116:
-------------------------------
Summary: Avro compiler(s) should reject uses of Java reserved identifiers
like 'record' in names (was: Avro compiler(s) should reject uses of 'record'
in names)
> Avro compiler(s) should reject uses of Java reserved identifiers like
> 'record' in names
> ---------------------------------------------------------------------------------------
>
> Key: AVRO-3116
> URL: https://issues.apache.org/jira/browse/AVRO-3116
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.10.2
> Reporter: Ismaël Mejía
> Priority: Major
>
> Java 14 introduced 'record' as a restricted type name and cannot be used for
> type declarations. So Avro should not generate code that uses this in its
> name for example classes based on a schema with name 'record'.
> This can be reproduced easily in Avro's current codebase running the
> `TestSpecificCompiler` test with JDK 16.
> https://github.com/apache/avro/blob/bfe1d03d683d67cdb9a984c02c6b1eb75ffe7689/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java#L201
> {quote}
> public class record extends org.apache.avro.specific.SpecificRecordBase
> implements org.apache.avro.specific.SpecificRecord {
> ^
> as of release 14, 'record' is a restricted type name and cannot be used for
> type declarations
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:23:
> error: 'record' is not allowed here
> private static final BinaryMessageEncoder<record> ENCODER =
> ^
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:24:
> error: 'record' is not allowed here
> new BinaryMessageEncoder<record>(MODEL$, SCHEMA$);
> ^
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:26:
> error: 'record' is not allowed here
> private static final BinaryMessageDecoder<record> DECODER =
> ^
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:27:
> error: 'record' is not allowed here
> new BinaryMessageDecoder<record>(MODEL$, SCHEMA$);
> ^
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:33:
> error: 'record' is not allowed here
> public static BinaryMessageEncoder<record> getEncoder() {
> ^
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:41:
> error: 'record' is not allowed here
> public static BinaryMessageDecoder<record> getDecoder() {
> ^
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:50:
> error: 'record' is not allowed here
> public static BinaryMessageDecoder<record> createDecoder(SchemaStore
> resolver) {
> ^
> [main] ERROR org.apache.avro.compiler.specific.TestSpecificCompiler -
> /tmp/junit6626196665903310578/testInvalidParameterCounts1/sample/record.java:51:
> error: 'record' is not allowed here
> return new BinaryMessageDecoder<record>(MODEL$, SCHEMA$, resolver);
> {quote}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)