beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From echauc...@apache.org
Subject [beam] 12/24: Fix warning in coder construction by reflexion
Date Thu, 05 Sep 2019 14:48:05 GMT
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 cbd7c2bdd7ad96317b4a7545a28d35f467b05795
Author: Etienne Chauchot <echauchot@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);


Mime
View raw message