[jira] [Commented] (BEAM-308) PipelineOptions throws when using package-private PipelineOptions interfaces from multiple packages

2016-09-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15456510#comment-15456510
 ] 

ASF GitHub Bot commented on BEAM-308:
-

Github user asfgit closed the pull request at:

https://github.com/apache/incubator-beam/pull/862


> PipelineOptions throws when using package-private PipelineOptions interfaces 
> from multiple packages
> ---
>
> Key: BEAM-308
> URL: https://issues.apache.org/jira/browse/BEAM-308
> Project: Beam
>  Issue Type: Bug
>  Components: sdk-java-core
>Reporter: Scott Wegner
>Assignee: Scott Wegner
>Priority: Minor
>
> If a PipelineOptions instance is used as multiple PipelineOptions 
> package-private interfaces from different packages, {{PipelineOptions.as}} 
> will throw an exception:
> {quote}
> java.lang.IllegalArgumentException: non-public interfaces from different 
> packages
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:652)
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:592)
>   at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:244)
>   at java.lang.reflect.WeakCache.get(WeakCache.java:141)
>   at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:455)
>   at java.lang.reflect.Proxy.getProxyClass(Proxy.java:405)
>   at 
> org.apache.beam.sdk.options.PipelineOptionsFactory.validateWellFormed(PipelineOptionsFactory.java:620)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.as(ProxyInvocationHandler.java:209)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:135)
>   at com.sun.proxy.$Proxy6.as(Unknown Source)
> {quote}
> This fails because ProxyInvocationHandler attempts to create a Java Proxy 
> object implementing the full set of interfaces, which has the 
> [restriction|https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html#getProxyClass(java.lang.ClassLoader,%20java.lang.Class...)]:
>  
> bq. All non-public interfaces must be in the same package; otherwise, it 
> would not be possible for the proxy class to implement all of the interfaces, 
> regardless of what package it is defined in.
> This can be triggered in a couple edge-case scenarios:
> # {{PipelineOptions.as}} is called on the same PipelineOptions instance with 
> multiple package-private interfaces.
> # {{PipelineOptionsFactory.register}} is called with a package-private 
> interface, and then {{PipelineOptions.as}} is called with a different 
> package-private instance.
> We hit the second scenario in [DataflowSDK unit 
> tests|https://github.com/GoogleCloudPlatform/DataflowJavaSDK/pull/286#issuecomment-221438063].
>  It's hard to trigger, but possible.
> 
> I propose we make the behavior for package-private options explicit:
> # Give a better exception message if we hit this issue in 
> {{PipelineOptions.as}} listing the non-public interfaces and what packages 
> they're in.
> # Explicitly reject non-public interfaces from 
> {{PipelineOptionsFactory.register}}, since this state is global and is easier 
> to cause issues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (BEAM-308) PipelineOptions throws when using package-private PipelineOptions interfaces from multiple packages

2016-05-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15300778#comment-15300778
 ] 

ASF GitHub Bot commented on BEAM-308:
-

Github user asfgit closed the pull request at:

https://github.com/apache/incubator-beam/pull/390


> PipelineOptions throws when using package-private PipelineOptions interfaces 
> from multiple packages
> ---
>
> Key: BEAM-308
> URL: https://issues.apache.org/jira/browse/BEAM-308
> Project: Beam
>  Issue Type: Bug
>  Components: sdk-java-core
>Reporter: Scott Wegner
>Assignee: Scott Wegner
>Priority: Minor
>
> If a PipelineOptions instance is used as multiple PipelineOptions 
> package-private interfaces from different packages, {{PipelineOptions.as}} 
> will throw an exception:
> {quote}
> java.lang.IllegalArgumentException: non-public interfaces from different 
> packages
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:652)
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:592)
>   at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:244)
>   at java.lang.reflect.WeakCache.get(WeakCache.java:141)
>   at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:455)
>   at java.lang.reflect.Proxy.getProxyClass(Proxy.java:405)
>   at 
> org.apache.beam.sdk.options.PipelineOptionsFactory.validateWellFormed(PipelineOptionsFactory.java:620)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.as(ProxyInvocationHandler.java:209)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:135)
>   at com.sun.proxy.$Proxy6.as(Unknown Source)
> {quote}
> This fails because ProxyInvocationHandler attempts to create a Java Proxy 
> object implementing the full set of interfaces, which has the 
> [restriction|https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html#getProxyClass(java.lang.ClassLoader,%20java.lang.Class...)]:
>  
> bq. All non-public interfaces must be in the same package; otherwise, it 
> would not be possible for the proxy class to implement all of the interfaces, 
> regardless of what package it is defined in.
> This can be triggered in a couple edge-case scenarios:
> # {{PipelineOptions.as}} is called on the same PipelineOptions instance with 
> multiple package-private interfaces.
> # {{PipelineOptionsFactory.register}} is called with a package-private 
> interface, and then {{PipelineOptions.as}} is called with a different 
> package-private instance.
> We hit the second scenario in [DataflowSDK unit 
> tests|https://github.com/GoogleCloudPlatform/DataflowJavaSDK/pull/286#issuecomment-221438063].
>  It's hard to trigger, but possible.
> 
> I propose we make the behavior for package-private options explicit:
> # Give a better exception message if we hit this issue in 
> {{PipelineOptions.as}} listing the non-public interfaces and what packages 
> they're in.
> # Explicitly reject non-public interfaces from 
> {{PipelineOptionsFactory.register}}, since this state is global and is easier 
> to cause issues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (BEAM-308) PipelineOptions throws when using package-private PipelineOptions interfaces from multiple packages

2016-05-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15300644#comment-15300644
 ] 

ASF GitHub Bot commented on BEAM-308:
-

GitHub user swegner opened a pull request:

https://github.com/apache/incubator-beam/pull/390

[BEAM-308] Mark test PipelineOptions interface public

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

 - [ ] Make sure the PR title is formatted like:
   `[BEAM-] Description of pull request`
 - [ ] Make sure tests pass via `mvn clean verify`. (Even better, enable
   Travis-CI on your fork and ensure the whole test matrix passes).
 - [ ] Replace `` in the title with the actual Jira issue
   number, if there is one.
 - [ ] If this contribution is large, please file an Apache
   [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.txt).

---



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/swegner/incubator-beam pipelineoptions-public

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-beam/pull/390.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #390


commit 7abedfae13319c8e85bfc6a7f3fef4c7edeae9dd
Author: Scott Wegner 
Date:   2016-05-25T18:40:45Z

Mark test PipelineOptions interface public




> PipelineOptions throws when using package-private PipelineOptions interfaces 
> from multiple packages
> ---
>
> Key: BEAM-308
> URL: https://issues.apache.org/jira/browse/BEAM-308
> Project: Beam
>  Issue Type: Bug
>  Components: sdk-java-core
>Reporter: Scott Wegner
>Assignee: Scott Wegner
>Priority: Minor
>
> If a PipelineOptions instance is used as multiple PipelineOptions 
> package-private interfaces from different packages, {{PipelineOptions.as}} 
> will throw an exception:
> {quote}
> java.lang.IllegalArgumentException: non-public interfaces from different 
> packages
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:652)
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:592)
>   at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:244)
>   at java.lang.reflect.WeakCache.get(WeakCache.java:141)
>   at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:455)
>   at java.lang.reflect.Proxy.getProxyClass(Proxy.java:405)
>   at 
> org.apache.beam.sdk.options.PipelineOptionsFactory.validateWellFormed(PipelineOptionsFactory.java:620)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.as(ProxyInvocationHandler.java:209)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:135)
>   at com.sun.proxy.$Proxy6.as(Unknown Source)
> {quote}
> This fails because ProxyInvocationHandler attempts to create a Java Proxy 
> object implementing the full set of interfaces, which has the 
> [restriction|https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html#getProxyClass(java.lang.ClassLoader,%20java.lang.Class...)]:
>  
> bq. All non-public interfaces must be in the same package; otherwise, it 
> would not be possible for the proxy class to implement all of the interfaces, 
> regardless of what package it is defined in.
> This can be triggered in a couple edge-case scenarios:
> # {{PipelineOptions.as}} is called on the same PipelineOptions instance with 
> multiple package-private interfaces.
> # {{PipelineOptionsFactory.register}} is called with a package-private 
> interface, and then {{PipelineOptions.as}} is called with a different 
> package-private instance.
> We hit the second scenario in [DataflowSDK unit 
> tests|https://github.com/GoogleCloudPlatform/DataflowJavaSDK/pull/286#issuecomment-221438063].
>  It's hard to trigger, but possible.
> 
> I propose we make the behavior for package-private options explicit:
> # Give a better exception message if we hit this issue in 
> {{PipelineOptions.as}} listing the non-public interfaces and what packages 
> they're in.
> # Explicitly reject non-public interfaces from 
> {{PipelineOptionsFactory.register}}, since this state is global and is easier 
> to cause issues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (BEAM-308) PipelineOptions throws when using package-private PipelineOptions interfaces from multiple packages

2016-05-25 Thread Scott Wegner (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15300563#comment-15300563
 ] 

Scott Wegner commented on BEAM-308:
---

PR with failing test cases: 
https://github.com/apache/incubator-beam/pull/389/files

/cc [~bchambers] [~lcwik]

> PipelineOptions throws when using package-private PipelineOptions interfaces 
> from multiple packages
> ---
>
> Key: BEAM-308
> URL: https://issues.apache.org/jira/browse/BEAM-308
> Project: Beam
>  Issue Type: Bug
>  Components: sdk-java-core
>Reporter: Scott Wegner
>Assignee: Scott Wegner
>Priority: Minor
>
> If a PipelineOptions instance is used as multiple PipelineOptions 
> package-private interfaces from different packages, {{PipelineOptions.as}} 
> will throw an exception:
> {quote}
> java.lang.IllegalArgumentException: non-public interfaces from different 
> packages
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:652)
>   at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:592)
>   at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:244)
>   at java.lang.reflect.WeakCache.get(WeakCache.java:141)
>   at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:455)
>   at java.lang.reflect.Proxy.getProxyClass(Proxy.java:405)
>   at 
> org.apache.beam.sdk.options.PipelineOptionsFactory.validateWellFormed(PipelineOptionsFactory.java:620)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.as(ProxyInvocationHandler.java:209)
>   at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:135)
>   at com.sun.proxy.$Proxy6.as(Unknown Source)
> {quote}
> This fails because ProxyInvocationHandler attempts to create a Java Proxy 
> object implementing the full set of interfaces, which has the 
> [restriction|https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html#getProxyClass(java.lang.ClassLoader,%20java.lang.Class...)]:
>  
> bq. All non-public interfaces must be in the same package; otherwise, it 
> would not be possible for the proxy class to implement all of the interfaces, 
> regardless of what package it is defined in.
> This can be triggered in a couple edge-case scenarios:
> # {{PipelineOptions.as}} is called on the same PipelineOptions instance with 
> multiple package-private interfaces.
> # {{PipelineOptionsFactory.register}} is called with a package-private 
> interface, and then {{PipelineOptions.as}} is called with a different 
> package-private instance.
> We hit the second scenario in [DataflowSDK unit 
> tests|https://github.com/GoogleCloudPlatform/DataflowJavaSDK/pull/286#issuecomment-221438063].
>  It's hard to trigger, but possible.
> 
> I propose we make the behavior for package-private options explicit:
> # Give a better exception message if we hit this issue in 
> {{PipelineOptions.as}} listing the non-public interfaces and what packages 
> they're in.
> # Explicitly reject non-public interfaces from 
> {{PipelineOptionsFactory.register}}, since this state is global and is easier 
> to cause issues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)