You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Roy Teeuwen <ro...@teeuwen.be> on 2015/05/26 15:51:57 UTC

Make ResourceResolver implement Closeable

Hello,

As of Java 7, it is possible by implementing the Closeable or AutoCloseable to use the try-with-resources statement. This makes the notation a lot shorter than the try-finally block. Is there a reason that the ResourceResolver does not implement the Closeable interface, and would it be possible to let it implement it?

Greetings,
Roy

Re: Make ResourceResolver implement Closeable

Posted by Robert Munteanu <ro...@lmn.ro>.
On Fri, May 29, 2015 at 1:29 PM, Roy Teeuwen <ro...@teeuwen.be> wrote:
> To come back to my initial question. The closeable interface has been there from Java 1.5, so adding it would do no harm to older versions and would still make it work in Java 1.7+

Good point, filed SLING-4798 [1]

Robert


[1]: https://issues.apache.org/jira/browse/SLING-4798

>
> Greets
> Roy
>> On 26 May 2015, at 16:38, Carsten Ziegeler <cz...@apache.org> wrote:
>>
>> Am 26.05.15 um 16:14 schrieb Robert Munteanu:
>>> Hi Roy,
>>>
>>> On Tue, 2015-05-26 at 15:51 +0200, Roy Teeuwen wrote:
>>>> Hello,
>>>>
>>>> As of Java 7, it is possible by implementing the Closeable or
>>>> AutoCloseable to use the try-with-resources statement. This makes the
>>>> notation a lot shorter than the try-finally block. Is there a reason
>>>> that the ResourceResolver does not implement the Closeable interface,
>>>> and would it be possible to let it implement it?
>>>
>>> We should "just" move to Java 7 by default.
>>>
>> +1
>>
>> Carsten
>>
>>
>> --
>> Carsten Ziegeler
>> Adobe Research Switzerland
>> cziegeler@apache.org
>



-- 
Sent from my (old) computer

Re: Make ResourceResolver implement Closeable

Posted by Roy Teeuwen <ro...@teeuwen.be>.
To come back to my initial question. The closeable interface has been there from Java 1.5, so adding it would do no harm to older versions and would still make it work in Java 1.7+

Greets
Roy
> On 26 May 2015, at 16:38, Carsten Ziegeler <cz...@apache.org> wrote:
> 
> Am 26.05.15 um 16:14 schrieb Robert Munteanu:
>> Hi Roy,
>> 
>> On Tue, 2015-05-26 at 15:51 +0200, Roy Teeuwen wrote:
>>> Hello,
>>> 
>>> As of Java 7, it is possible by implementing the Closeable or 
>>> AutoCloseable to use the try-with-resources statement. This makes the 
>>> notation a lot shorter than the try-finally block. Is there a reason 
>>> that the ResourceResolver does not implement the Closeable interface, 
>>> and would it be possible to let it implement it?
>> 
>> We should "just" move to Java 7 by default.
>> 
> +1
> 
> Carsten
> 
> 
> -- 
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org


Re: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Roy Teeuwen <ro...@teeuwen.be>.
That would be a good idea. When looking at the AEM 6.1 technical requirements you can already see there is no more support for Oracle JDK 1.6, minimum Oracle JDK 1.7

Roy

> On 29 May 2015, at 11:23, Stefan Seifert <ss...@pro-vision.de> wrote:
> 
> it's just that we cannot use features like Closeable when we still support JDK 1.6.
> 
> if we do not want switch to JDK 1.7 now perhaps we should come up with a plan/roadmap when to do the switch and document it on the website, then it is possible for upstream projects to take this into account.
> 
> stefan 


Re: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Robert Munteanu <ro...@apache.org>.
On Fri, 2015-05-29 at 18:08 +0300, Robert Munteanu wrote:
> 
> On May 29, 2015 5:55 PM, "Daniel Klco" <da...@gmail.com> wrote:
> >
> > Considering that Oracle is already stopped public updates for both 
> Java 6
> > and that the Premium Support ends December 2015, it would seem to 
> make
> > sense to standardize on Java 7 for new development and change 
> everything
> > over at the end of the year.
> That would be nice. However, there's also IBM and HP and they don't 
> follow the same support policies as Oracle.
> Robert

I removed support for sling.java.version = 5 and made 6 the default.

https://issues.apache.org/jira/browse/SLING-4772

Robert

> >
> > Either way this shakes out, we should create a Java support 
> schedule to
> > make sure it's clear to users and contributors what versions are 
> supported,
> > default and end of life across the Sling Launchpad versions.
> >
> > -Dan
> >
> > On Fri, May 29, 2015 at 5:31 AM, Carsten Ziegeler <
> cziegeler@apache.org>
> > wrote:
> >
> > > Am 29.05.15 um 11:23 schrieb Stefan Seifert:
> > > > it's just that we cannot use features like Closeable when we 
> still
> > > support JDK 1.6.
> > >
> > > Yepp, that's why I said, if it makes sense for a bundle to be 
> based on
> > > 1.7 then we're free to do it.
> > >
> > > >
> > > > if we do not want switch to JDK 1.7 now perhaps we should come 
> up with a
> > > plan/roadmap when
> > > > to do the switch and document it on the website, then it is 
> possible
> > > for upstream projects to take this into account.
> > >
> > > The launchpad already requires Java 7, and everything runs on 
> Java 7.
> > > It's just that we should not blindly update everything to depend 
> on 7
> > >
> > > Regards
> > > Carsten
> > > --
> > > Carsten Ziegeler
> > > Adobe Research Switzerland
> > > cziegeler@apache.org
> > >


Re: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Robert Munteanu <ro...@gmail.com>.
On May 29, 2015 5:55 PM, "Daniel Klco" <da...@gmail.com> wrote:
>
> Considering that Oracle is already stopped public updates for both Java 6
> and that the Premium Support ends December 2015, it would seem to make
> sense to standardize on Java 7 for new development and change everything
> over at the end of the year.

That would be nice. However, there's also IBM and HP and they don't follow
the same support policies as Oracle.

Robert

>
> Either way this shakes out, we should create a Java support schedule to
> make sure it's clear to users and contributors what versions are
supported,
> default and end of life across the Sling Launchpad versions.
>
> -Dan
>
> On Fri, May 29, 2015 at 5:31 AM, Carsten Ziegeler <cz...@apache.org>
> wrote:
>
> > Am 29.05.15 um 11:23 schrieb Stefan Seifert:
> > > it's just that we cannot use features like Closeable when we still
> > support JDK 1.6.
> >
> > Yepp, that's why I said, if it makes sense for a bundle to be based on
> > 1.7 then we're free to do it.
> >
> > >
> > > if we do not want switch to JDK 1.7 now perhaps we should come up
with a
> > plan/roadmap when
> > > to do the switch and document it on the website, then it is possible
> > for upstream projects to take this into account.
> >
> > The launchpad already requires Java 7, and everything runs on Java 7.
> > It's just that we should not blindly update everything to depend on 7
> >
> > Regards
> > Carsten
> > --
> > Carsten Ziegeler
> > Adobe Research Switzerland
> > cziegeler@apache.org
> >

Re: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Daniel Klco <da...@gmail.com>.
Considering that Oracle is already stopped public updates for both Java 6
and that the Premium Support ends December 2015, it would seem to make
sense to standardize on Java 7 for new development and change everything
over at the end of the year.

Either way this shakes out, we should create a Java support schedule to
make sure it's clear to users and contributors what versions are supported,
default and end of life across the Sling Launchpad versions.

-Dan

On Fri, May 29, 2015 at 5:31 AM, Carsten Ziegeler <cz...@apache.org>
wrote:

> Am 29.05.15 um 11:23 schrieb Stefan Seifert:
> > it's just that we cannot use features like Closeable when we still
> support JDK 1.6.
>
> Yepp, that's why I said, if it makes sense for a bundle to be based on
> 1.7 then we're free to do it.
>
> >
> > if we do not want switch to JDK 1.7 now perhaps we should come up with a
> plan/roadmap when
> > to do the switch and document it on the website, then it is possible
> for upstream projects to take this into account.
>
> The launchpad already requires Java 7, and everything runs on Java 7.
> It's just that we should not blindly update everything to depend on 7
>
> Regards
> Carsten
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
>

Re: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Carsten Ziegeler <cz...@apache.org>.
Am 29.05.15 um 11:23 schrieb Stefan Seifert:
> it's just that we cannot use features like Closeable when we still support JDK 1.6.

Yepp, that's why I said, if it makes sense for a bundle to be based on
1.7 then we're free to do it.

> 
> if we do not want switch to JDK 1.7 now perhaps we should come up with a plan/roadmap when 
> to do the switch and document it on the website, then it is possible
for upstream projects to take this into account.

The launchpad already requires Java 7, and everything runs on Java 7.
It's just that we should not blindly update everything to depend on 7

Regards
Carsten
-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

RE: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Stefan Seifert <ss...@pro-vision.de>.
it's just that we cannot use features like Closeable when we still support JDK 1.6.

if we do not want switch to JDK 1.7 now perhaps we should come up with a plan/roadmap when to do the switch and document it on the website, then it is possible for upstream projects to take this into account.

stefan 

Re: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Carsten Ziegeler <cz...@apache.org>.
I think we should allow Java 7 but not make it the default. 6 seems more
reasonable. It's like with dependencies to other bundles, we should use
the lowest version that makes sense :) So if there is no reason for
requiring 7 in a module, why should we?
Java 5 is way too old, so I think it doesn't make sense to support that.

I think we should also start supporting java 8 and update the parent pom
to allow this, even if that means that we disable the signature check
for java 8 for now.

Regards
Carsten
-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Stefan Egli <st...@apache.org>.
Assuming we switch, what should be the best practice to support upstream
dependencies on Java 6 (like AEM 6.1) when doing eg hotfix releases?
Afaics so far Sling did not adopt making branches for these cases.

Cheers,
Stefan

On 5/28/15 6:12 PM, "Stefan Seifert" <ss...@pro-vision.de> wrote:

>why not drop Java 6 support for new released bundles at all?
>
>+1 for using Java 7 as default and minimum Java version.
>
>stefan
>
>>-----Original Message-----
>>From: Robert Munteanu [mailto:rombert@apache.org]
>>Sent: Thursday, May 28, 2015 11:58 AM
>>To: dev@sling.apache.org
>>Subject: Moving to Java 7 ( was: Make ResourceResolver implement
>>Closeable)
>>
>>This might've been buried under the 'Closeable' thread so resending so
>>that it does not suprise anyone.
>>
>>Currently our projects can use either Java 5 or 6, with 5 being the
>>default. This is very much out of date and we're missing out on
>>language improvements. I would suggest changing the supported Java
>>versions from
>>
>>- 5 (default), 6
>>- 6, 7 (default)
>>
>>I would have preferred
>>
>>- 6, 7 (default), 8
>>
>>But Java 8 support is blocked due to SLING-4702 [1].
>>
>>Thoughts on the proposed change for the supported Java versions?
>>
>>Cheers,
>>
>>Robert
>>
>>[1]: https://issues.apache.org/jira/browse/SLING-4702
>>
>>On Tue, 2015-05-26 at 16:38 +0200, Carsten Ziegeler wrote:
>>> Am 26.05.15 um 16:14 schrieb Robert Munteanu:
>>> > Hi Roy,
>>> >
>>> > On Tue, 2015-05-26 at 15:51 +0200, Roy Teeuwen wrote:
>>> > > Hello,
>>> > >
>>> > > As of Java 7, it is possible by implementing the Closeable or
>>> > > AutoCloseable to use the try-with-resources statement. This makes
>>> > > the
>>> > > notation a lot shorter than the try-finally block. Is there a
>>> > > reason
>>> > > that the ResourceResolver does not implement the Closeable
>>> > > interface,
>>> > > and would it be possible to let it implement it?
>>> >
>>> > We should "just" move to Java 7 by default.
>>> >
>>> +1
>>>
>>> Carsten
>>>
>>>
>



RE: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Stefan Seifert <ss...@pro-vision.de>.
why not drop Java 6 support for new released bundles at all?

+1 for using Java 7 as default and minimum Java version.

stefan

>-----Original Message-----
>From: Robert Munteanu [mailto:rombert@apache.org]
>Sent: Thursday, May 28, 2015 11:58 AM
>To: dev@sling.apache.org
>Subject: Moving to Java 7 ( was: Make ResourceResolver implement Closeable)
>
>This might've been buried under the 'Closeable' thread so resending so
>that it does not suprise anyone.
>
>Currently our projects can use either Java 5 or 6, with 5 being the
>default. This is very much out of date and we're missing out on
>language improvements. I would suggest changing the supported Java
>versions from
>
>- 5 (default), 6
>- 6, 7 (default)
>
>I would have preferred
>
>- 6, 7 (default), 8
>
>But Java 8 support is blocked due to SLING-4702 [1].
>
>Thoughts on the proposed change for the supported Java versions?
>
>Cheers,
>
>Robert
>
>[1]: https://issues.apache.org/jira/browse/SLING-4702
>
>On Tue, 2015-05-26 at 16:38 +0200, Carsten Ziegeler wrote:
>> Am 26.05.15 um 16:14 schrieb Robert Munteanu:
>> > Hi Roy,
>> >
>> > On Tue, 2015-05-26 at 15:51 +0200, Roy Teeuwen wrote:
>> > > Hello,
>> > >
>> > > As of Java 7, it is possible by implementing the Closeable or
>> > > AutoCloseable to use the try-with-resources statement. This makes
>> > > the
>> > > notation a lot shorter than the try-finally block. Is there a
>> > > reason
>> > > that the ResourceResolver does not implement the Closeable
>> > > interface,
>> > > and would it be possible to let it implement it?
>> >
>> > We should "just" move to Java 7 by default.
>> >
>> +1
>>
>> Carsten
>>
>>


Moving to Java 7 ( was: Make ResourceResolver implement Closeable)

Posted by Robert Munteanu <ro...@apache.org>.
This might've been buried under the 'Closeable' thread so resending so
that it does not suprise anyone.

Currently our projects can use either Java 5 or 6, with 5 being the
default. This is very much out of date and we're missing out on
language improvements. I would suggest changing the supported Java
versions from

- 5 (default), 6
- 6, 7 (default)

I would have preferred

- 6, 7 (default), 8

But Java 8 support is blocked due to SLING-4702 [1]. 

Thoughts on the proposed change for the supported Java versions?

Cheers,

Robert

[1]: https://issues.apache.org/jira/browse/SLING-4702

On Tue, 2015-05-26 at 16:38 +0200, Carsten Ziegeler wrote:
> Am 26.05.15 um 16:14 schrieb Robert Munteanu:
> > Hi Roy,
> > 
> > On Tue, 2015-05-26 at 15:51 +0200, Roy Teeuwen wrote:
> > > Hello,
> > > 
> > > As of Java 7, it is possible by implementing the Closeable or 
> > > AutoCloseable to use the try-with-resources statement. This makes 
> > > the 
> > > notation a lot shorter than the try-finally block. Is there a 
> > > reason 
> > > that the ResourceResolver does not implement the Closeable 
> > > interface, 
> > > and would it be possible to let it implement it?
> > 
> > We should "just" move to Java 7 by default.
> > 
> +1
> 
> Carsten
> 
> 


Re: Make ResourceResolver implement Closeable

Posted by Carsten Ziegeler <cz...@apache.org>.
Am 26.05.15 um 16:14 schrieb Robert Munteanu:
> Hi Roy,
> 
> On Tue, 2015-05-26 at 15:51 +0200, Roy Teeuwen wrote:
>> Hello,
>>
>> As of Java 7, it is possible by implementing the Closeable or 
>> AutoCloseable to use the try-with-resources statement. This makes the 
>> notation a lot shorter than the try-finally block. Is there a reason 
>> that the ResourceResolver does not implement the Closeable interface, 
>> and would it be possible to let it implement it?
> 
> We should "just" move to Java 7 by default.
> 
+1

Carsten


-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: Make ResourceResolver implement Closeable

Posted by Robert Munteanu <ro...@apache.org>.
Hi Roy,

On Tue, 2015-05-26 at 15:51 +0200, Roy Teeuwen wrote:
> Hello,
> 
> As of Java 7, it is possible by implementing the Closeable or 
> AutoCloseable to use the try-with-resources statement. This makes the 
> notation a lot shorter than the try-finally block. Is there a reason 
> that the ResourceResolver does not implement the Closeable interface, 
> and would it be possible to let it implement it?

We should "just" move to Java 7 by default.

Cheers,

Robert