This is an automated email from the ASF dual-hosted git repository.

echauchot pushed a commit to branch spark-runner_structured-streaming
in repository https://gitbox.apache.org/repos/asf/beam.git

commit fdba22d33205db9b039e82204e6e95f9c0e69d50
Author: Etienne Chauchot <echauc...@apache.org>
AuthorDate: Wed Sep 4 14:55:32 2019 +0200

    Fix warning in coder construction by reflexion
---
 .../structuredstreaming/translation/helpers/EncoderHelpers.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
 
b/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
index 694bc24..1d89101 100644
--- 
a/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
+++ 
b/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
@@ -293,7 +293,7 @@ public class EncoderHelpers {
 
     @Override public Object nullSafeEval(Object input) {
       try {
-        Coder<T> beamCoder = coderClass.newInstance();
+        Coder<T> beamCoder = coderClass.getDeclaredConstructor().newInstance();
         return beamCoder.decode(new ByteArrayInputStream((byte[]) input));
       } catch (Exception e) {
         throw new IllegalStateException("Error decoding bytes for coder: " + 
coderClass, e);
@@ -373,13 +373,13 @@ case class DecodeUsingSerializer[T](child: Expression, 
tag: ClassTag[T], kryo: B
     ctx.addImmutableStateIfNotExists(coderClass.getName(), beamCoderInstance, 
func(v1 -> {
       /*
     CODE GENERATED
-    v = (coderClass) coderClass.newInstance();
+    v = (coderClass) coderClass.getDeclaredConstructor().newInstance();
      */
         List<String> parts = new ArrayList<>();
         parts.add("");
         parts.add(" = (");
         parts.add(") ");
-        parts.add(".newInstance();");
+        parts.add(".getDeclaredConstructor().newInstance();");
         StringContext sc = new 
StringContext(JavaConversions.collectionAsScalaIterable(parts).toSeq());
         List<Object> args = new ArrayList<>();
         args.add(v1);

Reply via email to