Re: Contributing to Apache Commons (Beginner task)

2017-03-23 Thread Gilles

Hello.

On Thu, 23 Mar 2017 21:02:11 +0100, Vladimir Kaplarevic wrote:

Hello,

I am looking to contribute to Apache Commons and start of with some 
basic

beginner task. I came across this:

https://helpwanted.apache.org/task.html?532e1a732ca32a4e35fc7fc0e4c9373b6af1c17d

If possible, I would like to help out but I am not sure about the 
steps
that I need to take here - ask to get jira ticket assigned, I guess? 
Also,

I am not sure that I can find the jira ticket in here
 .

Any help is very much appreciated.


Thanks for your interest.
The wording in the " helpwanted" request is a bit out-of-date,
since the release happened last December.
However, it is still very useful to try out the code in real
applications and report of any problems.  You could also design
"toy" applications tailored to illustrate features of the library
(see the "commons-rng-examples" module in the source repository).

You could also have a look at the open issues (although those
might not be beginner tasks).

Don't hesitate to ask more questions, so we can focus more
precisely on what you want to do.

Best regards,
Gilles


-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Contributing to Apache Commons (Beginner task)

2017-03-23 Thread Vladimir Kaplarevic
Hello,

I am looking to contribute to Apache Commons and start of with some basic
beginner task. I came across this:
https://helpwanted.apache.org/task.html?532e1a732ca32a4e35fc7fc0e4c9373b6af1c17d

If possible, I would like to help out but I am not sure about the steps
that I need to take here - ask to get jira ticket assigned, I guess? Also,
I am not sure that I can find the jira ticket in here
 .

Any help is very much appreciated.


-- 
Kind Regards,

Vladimir


Re: [Collections] UnmodifiableSet/UnmodifiableList

2017-03-23 Thread Javen O'Neal
Because either (1) UnmodifiableSet implents the Set interface and throws an
Invalid operations working at runtime for methods that would modify the set
or (2) UnmodifiableSet does not implement the full Set interface, making it
possible to catch errors at compile time, but also making it impossible to
treat an UnmodifiableSet as a Set.
The best solution is to document where you return an UnmodifiableSet versus
a regular Set in your Javadocs.

On Mar 23, 2017 08:35, "sebb"  wrote:

> On 23 March 2017 at 15:02, Lukasz Lenart  wrote:
> > 2017-03-23 14:37 GMT+01:00 sebb :
> >> Not sure I follow.
> >>
> >> What exactly can the compiler check?
> >
> > You can declare a variable or a field of type UnmodifiableSet but
> > there is no way to create instance of the type UnmodifiableSet - there
> > is no such constructor neither factory method :)
> >
>
> You can create an instance:
>
> UnmodifiableSet us = (UnmodifiableSet)
> UnmodifiableSet.unmodifiableSet(new java.util.HashSet());
> us.clear(); // The compiler is happy with this, but it fails at
> runtime
>
> AFAICT the only way the compiler can check is to create a class or
> interface that does not have the update methods.
>
> One could potentially create a ReadOnlySet interface that is
> implemented by UnmodifiableSet.
> Similarly for the other unmodifiable Collections.
>
> However would it be worth it?
>
> > Regards
> > --
> > Łukasz
> > + 48 606 323 122 http://www.lenart.org.pl/
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > For additional commands, e-mail: dev-h...@commons.apache.org
> >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


Re: [Collections] UnmodifiableSet/UnmodifiableList

2017-03-23 Thread sebb
On 23 March 2017 at 15:02, Lukasz Lenart  wrote:
> 2017-03-23 14:37 GMT+01:00 sebb :
>> Not sure I follow.
>>
>> What exactly can the compiler check?
>
> You can declare a variable or a field of type UnmodifiableSet but
> there is no way to create instance of the type UnmodifiableSet - there
> is no such constructor neither factory method :)
>

You can create an instance:

UnmodifiableSet us = (UnmodifiableSet)
UnmodifiableSet.unmodifiableSet(new java.util.HashSet());
us.clear(); // The compiler is happy with this, but it fails at runtime

AFAICT the only way the compiler can check is to create a class or
interface that does not have the update methods.

One could potentially create a ReadOnlySet interface that is
implemented by UnmodifiableSet.
Similarly for the other unmodifiable Collections.

However would it be worth it?

> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [Collections] UnmodifiableSet/UnmodifiableList

2017-03-23 Thread Lukasz Lenart
2017-03-23 14:37 GMT+01:00 sebb :
> Not sure I follow.
>
> What exactly can the compiler check?

You can declare a variable or a field of type UnmodifiableSet but
there is no way to create instance of the type UnmodifiableSet - there
is no such constructor neither factory method :)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [Collections] UnmodifiableSet/UnmodifiableList

2017-03-23 Thread Matt Sicker
I think the idea is giving a subset of the Set methods that are read-only.
Any write operations wouldn't be available on the interface, so you
couldn't compile it.

On 23 March 2017 at 08:37, sebb  wrote:

> On 23 March 2017 at 07:48, Lukasz Lenart  wrote:
> > Hi,
> >
> > I see that the Collections4 provides those classes. Anyway I wonder
> > why I the constructor is private and why the factory method
> > unmodifiableSet() returns Set?
> >
> > I would love to use those classes directly, to be straightforward that
> > I expect the UnmodifiableSet and not just a Set.
> >
> > What about adding a method like in Guava? Something like this:
> >
> > public static UnmodifiableSet of(Set set)
> >
> > This allows define UnmodifiableSets in code and use compiler to check
> > if everything is ok.
>
> Not sure I follow.
>
> What exactly can the compiler check?
>
> The API for UnmodifiableSet is basically the same as the API for Set.
>
> Yes, it implements Unmodifiable, but that is a Collections4 class and
> means nothing to the compiler.
>
> It is only at run-time that the the classes throw an error for update
> operations.
>
> >
> > Regards
> > --
> > Łukasz
> > + 48 606 323 122 http://www.lenart.org.pl/
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > For additional commands, e-mail: dev-h...@commons.apache.org
> >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


-- 
Matt Sicker 


Re: [Collections] UnmodifiableSet/UnmodifiableList

2017-03-23 Thread sebb
On 23 March 2017 at 07:48, Lukasz Lenart  wrote:
> Hi,
>
> I see that the Collections4 provides those classes. Anyway I wonder
> why I the constructor is private and why the factory method
> unmodifiableSet() returns Set?
>
> I would love to use those classes directly, to be straightforward that
> I expect the UnmodifiableSet and not just a Set.
>
> What about adding a method like in Guava? Something like this:
>
> public static UnmodifiableSet of(Set set)
>
> This allows define UnmodifiableSets in code and use compiler to check
> if everything is ok.

Not sure I follow.

What exactly can the compiler check?

The API for UnmodifiableSet is basically the same as the API for Set.

Yes, it implements Unmodifiable, but that is a Collections4 class and
means nothing to the compiler.

It is only at run-time that the the classes throw an error for update
operations.

>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[Collections] UnmodifiableSet/UnmodifiableList

2017-03-23 Thread Lukasz Lenart
Hi,

I see that the Collections4 provides those classes. Anyway I wonder
why I the constructor is private and why the factory method
unmodifiableSet() returns Set?

I would love to use those classes directly, to be straightforward that
I expect the UnmodifiableSet and not just a Set.

What about adding a method like in Guava? Something like this:

public static UnmodifiableSet of(Set set)

This allows define UnmodifiableSets in code and use compiler to check
if everything is ok.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org