github-code-scanning[bot] commented on code in PR #2322:
URL: https://github.com/apache/avro/pull/2322#discussion_r1257365825
##########
lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java:
##########
@@ -608,21 +613,188 @@
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) MODEL$
- .createDatumWriter(SCHEMA$);
+ private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumWriter(CODER.SCHEMA$);
@Override
public void writeExternal(java.io.ObjectOutput out) throws
java.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) MODEL$
- .createDatumReader(SCHEMA$);
+ private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumReader(CODER.SCHEMA$);
@Override
public void readExternal(java.io.ObjectInput in) throws java.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
+ @Override
+ protected boolean hasCustomCoders() {
+ return true;
+ }
+
+ @Override
+ public void customEncode(org.apache.avro.io.Encoder out) throws
java.io.IOException {
+ out.writeInt(this.id);
+
+ out.writeString(this.name);
+
+ long size0 = this.nicknames.size();
+ out.writeArrayStart();
+ out.setItemCount(size0);
+ long actualSize0 = 0;
+ for (java.lang.CharSequence e0 : this.nicknames) {
+ actualSize0++;
+ out.startItem();
+ out.writeString(e0);
+ }
+ out.writeArrayEnd();
+ if (actualSize0 != size0)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size0 + ", but element count was " +
actualSize0 + ".");
+
+ long size1 = this.relatedids.size();
+ out.writeArrayStart();
+ out.setItemCount(size1);
+ long actualSize1 = 0;
+ for (java.lang.Integer e1 : this.relatedids) {
+ actualSize1++;
+ out.startItem();
+ out.writeInt(e1);
+ }
+ out.writeArrayEnd();
+ if (actualSize1 != size1)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size1 + ", but element count was " +
actualSize1 + ".");
+
+ if (this.typeEnum == null) {
+ out.writeIndex(0);
+ out.writeNull();
+ } else {
+ out.writeIndex(1);
+ out.writeEnum(this.typeEnum.ordinal());
+ }
+
+ }
+
+ @Override
+ public void customDecode(org.apache.avro.io.ResolvingDecoder in) throws
java.io.IOException {
+ org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
+ if (fieldOrder == null) {
+ this.id = in.readInt();
+
+ this.name = in.readString(this.name instanceof Utf8 ? (Utf8) this.name :
null);
+
+ long size0 = in.readArrayStart();
+ java.util.List<java.lang.CharSequence> a0 = this.nicknames;
+ if (a0 == null) {
+ a0 = new SpecificData.Array<java.lang.CharSequence>((int) size0,
CODER.SCHEMA$.getField("nicknames").schema());
+ this.nicknames = a0;
+ } else
+ a0.clear();
+ SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.CharSequence>) a0
Review Comment:
## Cast from abstract to concrete collection
[List<CharSequence>](1) is cast to the concrete type
[Array<CharSequence>](2), losing abstraction.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3001)
##########
lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java:
##########
@@ -96,17 +96,17 @@
@Test
void convertGenericToSpecific() {
- GenericRecord generic = new GenericData.Record(TestRecord.SCHEMA$);
+ GenericRecord generic = new
GenericData.Record(TestRecord.getClassSchema());
generic.put("name", "foo");
generic.put("kind", new GenericData.EnumSymbol(Kind.SCHEMA$, "BAR"));
generic.put("hash",
new GenericData.Fixed(MD5.SCHEMA$, new byte[] { 0, 1, 2, 3, 4, 5, 6,
7, 8, 9, 0, 1, 2, 3, 4, 5 }));
- TestRecord specific = (TestRecord)
SpecificData.get().deepCopy(TestRecord.SCHEMA$, generic);
+ TestRecord specific = (TestRecord)
SpecificData.get().deepCopy(TestRecord.getClassSchema(), generic);
Review Comment:
## Unread local variable
Variable 'TestRecord specific' is never read.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3005)
##########
lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java:
##########
@@ -608,21 +613,188 @@
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) MODEL$
- .createDatumWriter(SCHEMA$);
+ private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumWriter(CODER.SCHEMA$);
@Override
public void writeExternal(java.io.ObjectOutput out) throws
java.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) MODEL$
- .createDatumReader(SCHEMA$);
+ private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumReader(CODER.SCHEMA$);
@Override
public void readExternal(java.io.ObjectInput in) throws java.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
+ @Override
+ protected boolean hasCustomCoders() {
+ return true;
+ }
+
+ @Override
+ public void customEncode(org.apache.avro.io.Encoder out) throws
java.io.IOException {
+ out.writeInt(this.id);
+
+ out.writeString(this.name);
+
+ long size0 = this.nicknames.size();
+ out.writeArrayStart();
+ out.setItemCount(size0);
+ long actualSize0 = 0;
+ for (java.lang.CharSequence e0 : this.nicknames) {
+ actualSize0++;
+ out.startItem();
+ out.writeString(e0);
+ }
+ out.writeArrayEnd();
+ if (actualSize0 != size0)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size0 + ", but element count was " +
actualSize0 + ".");
+
+ long size1 = this.relatedids.size();
+ out.writeArrayStart();
+ out.setItemCount(size1);
+ long actualSize1 = 0;
+ for (java.lang.Integer e1 : this.relatedids) {
+ actualSize1++;
+ out.startItem();
+ out.writeInt(e1);
+ }
+ out.writeArrayEnd();
+ if (actualSize1 != size1)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size1 + ", but element count was " +
actualSize1 + ".");
+
+ if (this.typeEnum == null) {
+ out.writeIndex(0);
+ out.writeNull();
+ } else {
+ out.writeIndex(1);
+ out.writeEnum(this.typeEnum.ordinal());
+ }
+
+ }
+
+ @Override
+ public void customDecode(org.apache.avro.io.ResolvingDecoder in) throws
java.io.IOException {
+ org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
+ if (fieldOrder == null) {
+ this.id = in.readInt();
+
+ this.name = in.readString(this.name instanceof Utf8 ? (Utf8) this.name :
null);
+
+ long size0 = in.readArrayStart();
+ java.util.List<java.lang.CharSequence> a0 = this.nicknames;
+ if (a0 == null) {
+ a0 = new SpecificData.Array<java.lang.CharSequence>((int) size0,
CODER.SCHEMA$.getField("nicknames").schema());
+ this.nicknames = a0;
+ } else
+ a0.clear();
+ SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.CharSequence>) a0
+ : null);
+ for (; 0 < size0; size0 = in.arrayNext()) {
+ for (; size0 != 0; size0--) {
+ java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null);
+ e0 = in.readString(e0 instanceof Utf8 ? (Utf8) e0 : null);
+ a0.add(e0);
+ }
+ }
+
+ long size1 = in.readArrayStart();
+ java.util.List<java.lang.Integer> a1 = this.relatedids;
+ if (a1 == null) {
+ a1 = new SpecificData.Array<java.lang.Integer>((int) size1,
CODER.SCHEMA$.getField("relatedids").schema());
+ this.relatedids = a1;
+ } else
+ a1.clear();
+ SpecificData.Array<java.lang.Integer> ga1 = (a1 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.Integer>) a1
+ : null);
+ for (; 0 < size1; size1 = in.arrayNext()) {
+ for (; size1 != 0; size1--) {
+ java.lang.Integer e1 = (ga1 != null ? ga1.peek() : null);
+ e1 = in.readInt();
+ a1.add(e1);
+ }
+ }
+
+ if (in.readIndex() != 1) {
+ in.readNull();
+ this.typeEnum = null;
+ } else {
+ this.typeEnum = org.apache.avro.TypeEnum.values()[in.readEnum()];
+ }
+
+ } else {
+ for (int i = 0; i < 5; i++) {
+ switch (fieldOrder[i].pos()) {
+ case 0:
+ this.id = in.readInt();
+ break;
+
+ case 1:
+ this.name = in.readString(this.name instanceof Utf8 ? (Utf8)
this.name : null);
+ break;
+
+ case 2:
+ long size0 = in.readArrayStart();
+ java.util.List<java.lang.CharSequence> a0 = this.nicknames;
+ if (a0 == null) {
+ a0 = new SpecificData.Array<java.lang.CharSequence>((int) size0,
+ CODER.SCHEMA$.getField("nicknames").schema());
+ this.nicknames = a0;
+ } else
+ a0.clear();
+ SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.CharSequence>) a0
Review Comment:
## Cast from abstract to concrete collection
[List<CharSequence>](1) is cast to the concrete type
[Array<CharSequence>](2), losing abstraction.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3003)
##########
lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java:
##########
@@ -608,21 +613,188 @@
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) MODEL$
- .createDatumWriter(SCHEMA$);
+ private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumWriter(CODER.SCHEMA$);
@Override
public void writeExternal(java.io.ObjectOutput out) throws
java.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) MODEL$
- .createDatumReader(SCHEMA$);
+ private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumReader(CODER.SCHEMA$);
@Override
public void readExternal(java.io.ObjectInput in) throws java.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
+ @Override
+ protected boolean hasCustomCoders() {
+ return true;
+ }
+
+ @Override
+ public void customEncode(org.apache.avro.io.Encoder out) throws
java.io.IOException {
+ out.writeInt(this.id);
+
+ out.writeString(this.name);
+
+ long size0 = this.nicknames.size();
+ out.writeArrayStart();
+ out.setItemCount(size0);
+ long actualSize0 = 0;
+ for (java.lang.CharSequence e0 : this.nicknames) {
+ actualSize0++;
+ out.startItem();
+ out.writeString(e0);
+ }
+ out.writeArrayEnd();
+ if (actualSize0 != size0)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size0 + ", but element count was " +
actualSize0 + ".");
+
+ long size1 = this.relatedids.size();
+ out.writeArrayStart();
+ out.setItemCount(size1);
+ long actualSize1 = 0;
+ for (java.lang.Integer e1 : this.relatedids) {
+ actualSize1++;
+ out.startItem();
+ out.writeInt(e1);
+ }
+ out.writeArrayEnd();
+ if (actualSize1 != size1)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size1 + ", but element count was " +
actualSize1 + ".");
+
+ if (this.typeEnum == null) {
+ out.writeIndex(0);
+ out.writeNull();
+ } else {
+ out.writeIndex(1);
+ out.writeEnum(this.typeEnum.ordinal());
+ }
+
+ }
+
+ @Override
+ public void customDecode(org.apache.avro.io.ResolvingDecoder in) throws
java.io.IOException {
+ org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
+ if (fieldOrder == null) {
+ this.id = in.readInt();
+
+ this.name = in.readString(this.name instanceof Utf8 ? (Utf8) this.name :
null);
+
+ long size0 = in.readArrayStart();
+ java.util.List<java.lang.CharSequence> a0 = this.nicknames;
+ if (a0 == null) {
+ a0 = new SpecificData.Array<java.lang.CharSequence>((int) size0,
CODER.SCHEMA$.getField("nicknames").schema());
+ this.nicknames = a0;
+ } else
+ a0.clear();
+ SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.CharSequence>) a0
+ : null);
+ for (; 0 < size0; size0 = in.arrayNext()) {
+ for (; size0 != 0; size0--) {
+ java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null);
+ e0 = in.readString(e0 instanceof Utf8 ? (Utf8) e0 : null);
+ a0.add(e0);
+ }
+ }
+
+ long size1 = in.readArrayStart();
+ java.util.List<java.lang.Integer> a1 = this.relatedids;
+ if (a1 == null) {
+ a1 = new SpecificData.Array<java.lang.Integer>((int) size1,
CODER.SCHEMA$.getField("relatedids").schema());
+ this.relatedids = a1;
+ } else
+ a1.clear();
+ SpecificData.Array<java.lang.Integer> ga1 = (a1 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.Integer>) a1
Review Comment:
## Cast from abstract to concrete collection
[List<Integer>](1) is cast to the concrete type [Array<Integer>](2), losing
abstraction.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3002)
##########
lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java:
##########
@@ -922,6 +927,60 @@
}
}
+ @Test
+ void inheritance() throws IOException, ClassNotFoundException,
InstantiationException, IllegalAccessException {
+ File parentFile = new File("src/test/resources/inheritance/parent.avsc");
+ Assertions.assertTrue(parentFile.exists());
+ File childFile = new File("src/test/resources/inheritance/child.avsc");
+ SpecificCompiler.compileSchema(new File[] { parentFile, childFile },
OUTPUT_DIR);
+
+ File f1 = new File(this.OUTPUT_DIR, "Parent.java");
+ File f2 = new File(this.OUTPUT_DIR, "Child.java");
+ Assertions.assertTrue(f2.exists());
+ // String code = new String(Files.readAllBytes(f2.toPath()));
+ // System.out.println(code);
+
+ DiagnosticCollector<JavaFileObject> diagnostics = new
DiagnosticCollector<>();
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ StandardJavaFileManager fileManager =
compiler.getStandardFileManager(diagnostics, null, null);
+
+ // This sets up the class path that the compiler will use.
+ // I've added the .jar file that contains the DoStuff interface within in
it...
+ List<String> optionList = Collections.emptyList(); //
Arrays.asList("-classpath", this.OUTPUT_DIR.getName());
+
+ Iterable<? extends JavaFileObject> compilationUnit =
fileManager.getJavaFileObjectsFromFiles(Arrays.asList(f1, f2));
+ JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager,
diagnostics, optionList, null,
+ compilationUnit);
+
/*********************************************************************************************
+ * Compilation Requirements
+ **/
+ if (task.call()) {
+ /**
+ * Load and execute
+
*************************************************************************************************/
+ // Create a new custom class loader, pointing to the directory that
contains the
+ // compiled
+ // classes, this should point to the top of the package structure!
+ URLClassLoader classLoader = new URLClassLoader(new URL[] {
this.OUTPUT_DIR.toURI().toURL() },
+ Thread.currentThread().getContextClassLoader());
+ // Load the class from the classloader by name....
+ Class<?> loadedClass = classLoader.loadClass("Parent");
+ // Create a new instance...
+ Object obj = loadedClass.newInstance();
Review Comment:
## Deprecated method or constructor invocation
Invoking [Class.newInstance](1) should be avoided because it has been
deprecated.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3006)
##########
lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java:
##########
@@ -608,21 +613,188 @@
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) MODEL$
- .createDatumWriter(SCHEMA$);
+ private static final org.apache.avro.io.DatumWriter<FooBarSpecificRecord>
WRITER$ = (org.apache.avro.io.DatumWriter<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumWriter(CODER.SCHEMA$);
@Override
public void writeExternal(java.io.ObjectOutput out) throws
java.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")
- private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) MODEL$
- .createDatumReader(SCHEMA$);
+ private static final org.apache.avro.io.DatumReader<FooBarSpecificRecord>
READER$ = (org.apache.avro.io.DatumReader<FooBarSpecificRecord>) CODER.MODEL$
+ .createDatumReader(CODER.SCHEMA$);
@Override
public void readExternal(java.io.ObjectInput in) throws java.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
+ @Override
+ protected boolean hasCustomCoders() {
+ return true;
+ }
+
+ @Override
+ public void customEncode(org.apache.avro.io.Encoder out) throws
java.io.IOException {
+ out.writeInt(this.id);
+
+ out.writeString(this.name);
+
+ long size0 = this.nicknames.size();
+ out.writeArrayStart();
+ out.setItemCount(size0);
+ long actualSize0 = 0;
+ for (java.lang.CharSequence e0 : this.nicknames) {
+ actualSize0++;
+ out.startItem();
+ out.writeString(e0);
+ }
+ out.writeArrayEnd();
+ if (actualSize0 != size0)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size0 + ", but element count was " +
actualSize0 + ".");
+
+ long size1 = this.relatedids.size();
+ out.writeArrayStart();
+ out.setItemCount(size1);
+ long actualSize1 = 0;
+ for (java.lang.Integer e1 : this.relatedids) {
+ actualSize1++;
+ out.startItem();
+ out.writeInt(e1);
+ }
+ out.writeArrayEnd();
+ if (actualSize1 != size1)
+ throw new java.util.ConcurrentModificationException(
+ "Array-size written was " + size1 + ", but element count was " +
actualSize1 + ".");
+
+ if (this.typeEnum == null) {
+ out.writeIndex(0);
+ out.writeNull();
+ } else {
+ out.writeIndex(1);
+ out.writeEnum(this.typeEnum.ordinal());
+ }
+
+ }
+
+ @Override
+ public void customDecode(org.apache.avro.io.ResolvingDecoder in) throws
java.io.IOException {
+ org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
+ if (fieldOrder == null) {
+ this.id = in.readInt();
+
+ this.name = in.readString(this.name instanceof Utf8 ? (Utf8) this.name :
null);
+
+ long size0 = in.readArrayStart();
+ java.util.List<java.lang.CharSequence> a0 = this.nicknames;
+ if (a0 == null) {
+ a0 = new SpecificData.Array<java.lang.CharSequence>((int) size0,
CODER.SCHEMA$.getField("nicknames").schema());
+ this.nicknames = a0;
+ } else
+ a0.clear();
+ SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.CharSequence>) a0
+ : null);
+ for (; 0 < size0; size0 = in.arrayNext()) {
+ for (; size0 != 0; size0--) {
+ java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null);
+ e0 = in.readString(e0 instanceof Utf8 ? (Utf8) e0 : null);
+ a0.add(e0);
+ }
+ }
+
+ long size1 = in.readArrayStart();
+ java.util.List<java.lang.Integer> a1 = this.relatedids;
+ if (a1 == null) {
+ a1 = new SpecificData.Array<java.lang.Integer>((int) size1,
CODER.SCHEMA$.getField("relatedids").schema());
+ this.relatedids = a1;
+ } else
+ a1.clear();
+ SpecificData.Array<java.lang.Integer> ga1 = (a1 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.Integer>) a1
+ : null);
+ for (; 0 < size1; size1 = in.arrayNext()) {
+ for (; size1 != 0; size1--) {
+ java.lang.Integer e1 = (ga1 != null ? ga1.peek() : null);
+ e1 = in.readInt();
+ a1.add(e1);
+ }
+ }
+
+ if (in.readIndex() != 1) {
+ in.readNull();
+ this.typeEnum = null;
+ } else {
+ this.typeEnum = org.apache.avro.TypeEnum.values()[in.readEnum()];
+ }
+
+ } else {
+ for (int i = 0; i < 5; i++) {
+ switch (fieldOrder[i].pos()) {
+ case 0:
+ this.id = in.readInt();
+ break;
+
+ case 1:
+ this.name = in.readString(this.name instanceof Utf8 ? (Utf8)
this.name : null);
+ break;
+
+ case 2:
+ long size0 = in.readArrayStart();
+ java.util.List<java.lang.CharSequence> a0 = this.nicknames;
+ if (a0 == null) {
+ a0 = new SpecificData.Array<java.lang.CharSequence>((int) size0,
+ CODER.SCHEMA$.getField("nicknames").schema());
+ this.nicknames = a0;
+ } else
+ a0.clear();
+ SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.CharSequence>) a0
+ : null);
+ for (; 0 < size0; size0 = in.arrayNext()) {
+ for (; size0 != 0; size0--) {
+ java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null);
+ e0 = in.readString(e0 instanceof Utf8 ? (Utf8) e0 : null);
+ a0.add(e0);
+ }
+ }
+ break;
+
+ case 3:
+ long size1 = in.readArrayStart();
+ java.util.List<java.lang.Integer> a1 = this.relatedids;
+ if (a1 == null) {
+ a1 = new SpecificData.Array<java.lang.Integer>((int) size1,
CODER.SCHEMA$.getField("relatedids").schema());
+ this.relatedids = a1;
+ } else
+ a1.clear();
+ SpecificData.Array<java.lang.Integer> ga1 = (a1 instanceof
SpecificData.Array
+ ? (SpecificData.Array<java.lang.Integer>) a1
Review Comment:
## Cast from abstract to concrete collection
[List<Integer>](1) is cast to the concrete type [Array<Integer>](2), losing
abstraction.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3004)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]