Repository: incubator-beam Updated Branches: refs/heads/master a38a6072d -> f8e26be7d
Fixes crash of shade plugin on SparkProcessContext Error discovered by debugging the Maven plugin itself (using mvnDebug) and setting a breakpoint for the exception and then inspecting the call stack to spot a weird-looking method signature descriptor: `Lorg/apache/beam/sdk/transforms/windowing/WindowFn<Ljava/lang/Object;!*>.AssignContext;` (note the exclamation mark, which is an invalid character AFAIK! I have no idea where it came from, but the current change makes it go away) Further change the signature to make javap happy When I compile beam using Eclipse Compiler in IntelliJ, this is the only file that produces an invalid class file unless I make the current change. Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/b83f4c45 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/b83f4c45 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/b83f4c45 Branch: refs/heads/master Commit: b83f4c45b20fce8d2b944bbe364a3726f9d1c84b Parents: a38a607 Author: Eugene Kirpichov <kirpic...@google.com> Authored: Mon Oct 31 18:06:43 2016 -0700 Committer: Dan Halperin <dhalp...@google.com> Committed: Tue Nov 1 08:27:10 2016 -0700 ---------------------------------------------------------------------- .../spark/translation/SparkProcessContext.java | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/b83f4c45/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java ---------------------------------------------------------------------- diff --git a/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java b/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java index 2135170..99cd522 100644 --- a/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java +++ b/runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkProcessContext.java @@ -176,31 +176,31 @@ public abstract class SparkProcessContext<InputT, OutputT, ValueT> } } - static <T> WindowedValue<T> noElementWindowedValue(final T output, - final Instant timestamp, - WindowFn<Object, ?> windowFn) { - WindowFn.AssignContext assignContext = windowFn.new AssignContext() { - - @Override - public Object element() { - return output; - } + static <T, W extends BoundedWindow> WindowedValue<T> noElementWindowedValue( + final T output, final Instant timestamp, WindowFn<Object, W> windowFn) { + WindowFn<Object, W>.AssignContext assignContext = + windowFn.new AssignContext() { + + @Override + public Object element() { + return output; + } - @Override - public Instant timestamp() { - if (timestamp != null) { - return timestamp; - } - throw new UnsupportedOperationException("outputWithTimestamp was called with " - + "null timestamp."); - } + @Override + public Instant timestamp() { + if (timestamp != null) { + return timestamp; + } + throw new UnsupportedOperationException( + "outputWithTimestamp was called with " + "null timestamp."); + } - @Override - public BoundedWindow window() { - throw new UnsupportedOperationException("Window not available for " - + "start/finishBundle output."); - } - }; + @Override + public BoundedWindow window() { + throw new UnsupportedOperationException( + "Window not available for " + "start/finishBundle output."); + } + }; try { @SuppressWarnings("unchecked") Collection<? extends BoundedWindow> windows = windowFn.assignWindows(assignContext);