Re: Process to add some default methods to javax.naming.Context?

2016-10-17 Thread Vincent Ryan
Please file an RFE for this issue so that the core-libs team can evaluate.
While this seems like a good use for default methods, it may be difficult to 
justify including a convenience method
at this late stage in the JDK 9 schedule.

Thanks.


> On 14 Oct 2016, at 22:21, Laird Nelson  wrote:
> 
> On Fri, Oct 14, 2016 at 7:19 AM Vincent Ryan  > wrote:
> The problem of having to cast the result of Context.lookup 
> 
>  can be solved using an existing method:
> InitialContext.doLookup 
> 
> 
> That solves the simple casting problem from an initial Context, but not for 
> all Contexts, and the simple addition of a relatively trivial default method 
> like this in the Context interface it seems to me would open the door for 
> Context implementers to reimplement it to do more sophisticated—and 
> deliberate—type conversion.
> 
> Best,
> Laird



Re: Process to add some default methods to javax.naming.Context?

2016-10-14 Thread Laird Nelson
On Fri, Oct 14, 2016 at 7:19 AM Vincent Ryan 
wrote:

> The problem of having to cast the result of Context.lookup
> 
>  can
> be solved using an existing method:
> InitialContext.doLookup
> 
>

That solves the simple casting problem from an initial Context, but not for
all Contexts, and the simple addition of a relatively trivial default
method like this in the Context interface it seems to me would open the
door for Context implementers to reimplement it to do more
sophisticated—and deliberate—type conversion.

Best,
Laird


Re: Process to add some default methods to javax.naming.Context?

2016-10-14 Thread mark . reinhold
2016/10/13 13:39:44 -0700, brian.go...@oracle.com:
> javax.naming is a JCP-controlled API.  Adding to it would require a 
> maintenance release of whichever JSR covers JNDI (probably the Java EE 
> umbrella JSR.)  You'll need to track down the spec lead and see if a MR 
> is in the works, and if you can convince them that this is a desirable 
> addition.

JNDI was merged into the JDK before the platform as a whole was governed
by the JCP, so there's never been a separate JSR for it.  Any changes to
the JNDI API would therefore be covered by the relevant Java SE Umbrella
JSR unless they were so significant as to require their own JSR -- which
at this stage seems pretty unlikely.

- Mark


Re: Process to add some default methods to javax.naming.Context?

2016-10-14 Thread Vincent Ryan
Hello Laird,

The problem of having to cast the result of Context.lookup 

 can be solved using an existing method:
InitialContext.doLookup 


Although it might not suit all uses because no JNDI environment properties are 
passed to the InitialContext
constructor that gets created within the method.



> On 13 Oct 2016, at 18:14, Laird Nelson  wrote:
> 
> Hello; I am new to this mailing list and its conventions; if I misstep I am
> happy to be pointed in the right direction.  I was directed here by Mark
> Reinhold.
> 
> Disclaimer in case it matters: I work for Oracle.
> 
> I have long wanted there to be methods in javax.naming.Context like the
> following:
> 
> // typed from memory off the cuff
> default  T lookup(final String name, final Class type) {
>  return type.cast(this.lookup(name));
> }
> // do similar things for other lookup* methods here
> 
> What would be the steps I would next need to take to help with this?
> 
> Thanks in advance for help, time and guidance,
> Best,
> Laird
> --
> http://about.me/lairdnelson



Re: Process to add some default methods to javax.naming.Context?

2016-10-13 Thread Brian Goetz
javax.naming is a JCP-controlled API.  Adding to it would require a 
maintenance release of whichever JSR covers JNDI (probably the Java EE 
umbrella JSR.)  You'll need to track down the spec lead and see if a MR 
is in the works, and if you can convince them that this is a desirable 
addition.


On 10/13/2016 1:14 PM, Laird Nelson wrote:

Hello; I am new to this mailing list and its conventions; if I misstep I am
happy to be pointed in the right direction.  I was directed here by Mark
Reinhold.

Disclaimer in case it matters: I work for Oracle.

I have long wanted there to be methods in javax.naming.Context like the
following:

// typed from memory off the cuff
default  T lookup(final String name, final Class type) {
   return type.cast(this.lookup(name));
}
// do similar things for other lookup* methods here

What would be the steps I would next need to take to help with this?

Thanks in advance for help, time and guidance,
Best,
Laird
--
http://about.me/lairdnelson