Re: Curly Generics Question - Update

2009-05-15 Thread Q


On 16/05/2009, at 12:07 PM, Mike Schrag wrote:

I'm not sure this is really any better ... Fundamentally there's a ?  
in that param, and as a result, it's impossible to do a put in a  
typesafe way.  You don't know what V is. I _think_ the signature as  
it is now is actually correct, but if you need to insert into that  
map inside createRequest, you simply have to copy it.  I don't think  
it's possible to ensure compiler-enforceable type-safety in any  
other way (which is to say, "accurate type safety").


Mike is right, you cannot safely insert anything into a wildcard  
parameterised "producer" type (? extends T) because you do not know  
what subtype of T it is actually meant to contain. You only know that  
it will "produce" elements that are assignable to T.  If you want to  
"put" anything, or rather have it "consume" values, it needs to be  
parameterised with the form , which will accept values that  
are assignable to T. Hence the PECS mantra, Producer extend Consumer  
super.  There is no way to express both a producer and consumer using  
a single wildcard expression.


Consumer:

Map>  allows for:

m.put("foo", new ArrayList("bar"));
m.put("foo", new NSArray("bar"));

You can safely insert anything that is a List

and

m = new NSDictionary>();
but not
m = new NSDictionary>();

You cannot safely upcast from a more specific type to List

Producer:

Map> allows for:

List t = m.get("foo");
but not
NSArray t = m.get("foo");

Everything you retrieve will be assignable to List

and

m = new NSDictionary>();
m = new HashMap>();
m = new NSDictionary>();

You can safely upcast to the more generic type of MapList>



Getting back to the original example:

public WORequest createRequest(String method,String url,String  
anHTTPVersion,Map> someHeaders,NSData  
content,Map someInfo)


It's unfortunately that the method signature of someHeaders was  
changed from NSDictionary to Map because the original contract of  
NSDictionary implies immutability, while Map has no such implication.  
But the intent can still be derived from the type parameters as being  
a producer. If you are overriding this method you should not assume  
that the someHeaders Map your were passed is mutable, you should clone  
it to a concrete mutable type if you wish to modify it.



On May 15, 2009, at 9:51 PM, Henrique Prange wrote:


Hi Mike,

The following solution doesn't solve the unchecked type cast  
problem. But it respect PECS definition and accept a MapNSArray> as parameter. Do you think it is reasonable?


public  > WORequest treateRequest(String  
method, String url, String anHTTPVersion, Map  
someHeaders, NSData content, Map someInfo) {

 ...
 someHeaders.put("foo", (V) Collections.singletonList("bar"));
 ...
}

Cheers,

Henrique

On May 15, 2009, at 8:29 PM, Mike Schrag wrote:

	Map< String, List< String >> correctHeaders = new HashMap<  
String, List< String > >();
btw, this is what i was saying that the only typesafe way to do  
this is to copy the original headers -- so you would do new  
HashMap>(originalHeaders) and then you'd have  
a properly typesafe > that you can happily  
insert into whatever List subtypes you want inside of  
createRequest. But it takes a copy to do it, which kind of sucks.


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com

This email sent to hpra...@gmail.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com

This email sent to msch...@mdimension.com



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/qdolan%40gmail.com

This email sent to qdo...@gmail.com




--
Seeya...Q

Quinton Dolan - qdo...@gmail.com
Gold Coast, QLD, Australia (GMT+10)
Ph: +61 419 729 806



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Anjo Krank


Am 16.05.2009 um 01:29 schrieb Mike Schrag:

	Map< String, List< String >> correctHeaders = new HashMap< String,  
List< String > >();
btw, this is what i was saying that the only typesafe way to do this  
is to copy the original headers -- so you would do new  
HashMap>(originalHeaders) and then you'd have a  
properly typesafe > that you can happily insert  
into whatever List subtypes you want inside of  
createRequest. But it takes a copy to do it, which kind of sucks.


As the whole point of this stupid and annoying API change to Map was  
that you could maintain order of the parameters, I'd at least use a  
TreeMap :)


Cheers, Anjo
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Oracle driver...

2009-05-15 Thread Don Lindsay
The Oracle 9i drivers are no longer supported or patched.Oracle  
Support advises everyone to use the latest drivers, they are 100%  
backwards compatible (wry smile).  For Java 1.5 use the OJDBC5.jar  
from 11i.  For Java 1.6 use OJDBC6.jar.  For java 1.4 use OJDBC14.jar,  
for java earlier than 1.4 use classes12.jar.


Could you post the errors you are encountering so we can take a look  
at them?


Don

On May 14, 2009, at 11:58 AM, Pascal Robert wrote:

For Oracle 9i, might be better to use one of the JDBC drivers that  
match Oracle DB server version :



http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html




If it helps we use WO 5.4.3 and ORACLE 10.2.0.4.0 with the  
ojdbc14.jar driver that goes with that ...  I got it from here:


http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html


On May 14, 2009, at 11:45 AM, Sherry Tirko wrote:



Hello All,

We just recently switched from WO 5.2.4 with Java 1.4 to WO 5.4.2  
with Java 1.5. We are using Oracle 9i. With are previous setup  
with used the classes12.jar for our jdbc connection. We were told  
to use the ojdbc14.jar with our new setup. We were seeing some  
jdbc adaptor errors before switching to the new driver. We are now  
seeing more adaptor errors. Could we have corrupted something by  
using the old driver or do we have the wrong driver now? Any  
insight would be greatly appreciated.


Thanks,
Sherry


Sherry Tirko
SOAR Project
Outreach Technology Services
814-865-9068
sl...@outreach.psu.edu



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/rparada%40mac.com

This email sent to rpar...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca

This email sent to prob...@macti.ca



---
Pascal Robert

http://www.macti.ca
http://www.aircourriel.com
http://www.linkedin.com/in/macti

Skype: MacTICanada
AIM/iChat : MacTICanada

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/pccdonl 
%40mac.com


This email sent to pccd...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread Mike Schrag
Thanks for letting us know. Works great. Very clean decompile. It is  
cool how it puts  /*  */ the the left of every  
code line too.
btw, you can do this with jad, too, with the -lnc option (there's a  
setting in jadclipse for it too) ...


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread Ricardo J. Parada
Did you guys have to remove jadclipse ?  Is there a conflict if one  
has jadclipse already installed?


:-)


On May 15, 2009, at 10:15 PM, Kieran Kelleher wrote:

Thanks for letting us know. Works great. Very clean decompile. It is  
cool how it puts  /*  */ the the left of every  
code line too.


On May 15, 2009, at 2:16 PM, Henrique Prange wrote:


Hi list,

Just to inform the Java Decompiler [1] plug-in for Eclipse is now  
available for Mac OS X. I have tried and it seems pretty good.


[1]http://java.decompiler.free.fr/

Cheers,

Henrique
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com

This email sent to kieran_li...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/rparada 
%40mac.com


This email sent to rpar...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Mike Schrag
I'm not sure this is really any better ... Fundamentally there's a ?  
in that param, and as a result, it's impossible to do a put in a  
typesafe way.  You don't know what V is. I _think_ the signature as it  
is now is actually correct, but if you need to insert into that map  
inside createRequest, you simply have to copy it.  I don't think it's  
possible to ensure compiler-enforceable type-safety in any other way  
(which is to say, "accurate type safety").


ms

On May 15, 2009, at 9:51 PM, Henrique Prange wrote:


Hi Mike,

The following solution doesn't solve the unchecked type cast  
problem. But it respect PECS definition and accept a MapNSArray> as parameter. Do you think it is reasonable?


public  > WORequest treateRequest(String  
method, String url, String anHTTPVersion, Map  
someHeaders, NSData content, Map someInfo) {

  ...
  someHeaders.put("foo", (V) Collections.singletonList("bar"));
  ...
}

Cheers,

Henrique

On May 15, 2009, at 8:29 PM, Mike Schrag wrote:

	Map< String, List< String >> correctHeaders = new HashMap<  
String, List< String > >();
btw, this is what i was saying that the only typesafe way to do  
this is to copy the original headers -- so you would do new  
HashMap>(originalHeaders) and then you'd have  
a properly typesafe > that you can happily  
insert into whatever List subtypes you want inside of  
createRequest. But it takes a copy to do it, which kind of sucks.


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com

This email sent to hpra...@gmail.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com

This email sent to msch...@mdimension.com



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread Kieran Kelleher
Thanks for letting us know. Works great. Very clean decompile. It is  
cool how it puts  /*  */ the the left of every  
code line too.


On May 15, 2009, at 2:16 PM, Henrique Prange wrote:


Hi list,

Just to inform the Java Decompiler [1] plug-in for Eclipse is now  
available for Mac OS X. I have tried and it seems pretty good.


[1]http://java.decompiler.free.fr/

Cheers,

Henrique
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com

This email sent to kieran_li...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Henrique Prange

Hi Mike,

The following solution doesn't solve the unchecked type cast problem.  
But it respect PECS definition and accept a MapNSArray> as parameter. Do you think it is reasonable?


public  > WORequest treateRequest(String  
method, String url, String anHTTPVersion, Map  
someHeaders, NSData content, Map someInfo) {

   ...
   someHeaders.put("foo", (V) Collections.singletonList("bar"));
   ...
}

Cheers,

Henrique

On May 15, 2009, at 8:29 PM, Mike Schrag wrote:

	Map< String, List< String >> correctHeaders = new HashMap< String,  
List< String > >();
btw, this is what i was saying that the only typesafe way to do this  
is to copy the original headers -- so you would do new  
HashMap>(originalHeaders) and then you'd have a  
properly typesafe > that you can happily insert  
into whatever List subtypes you want inside of  
createRequest. But it takes a copy to do it, which kind of sucks.


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com

This email sent to hpra...@gmail.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Lachlan Deck

On 16/05/2009, at 10:03 AM, Chuck Hill wrote:


On May 15, 2009, at 4:59 PM, Lachlan Deck wrote:


Generics are great mostly - but there are times when it's just  
downright annoying :-).


Sounds like Maven!

:-P


Touché ;-)

But still lovin' your work as the unlikely ambassador, finding every  
opportunity .. Maven here, maven there, maven loving everywhere ;-)


with regards,
--

Lachlan Deck

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Chuck Hill


On May 15, 2009, at 4:59 PM, Lachlan Deck wrote:


Generics are great mostly - but there are times when it's just  
downright annoying :-).



Sounds like Maven!

:-P

--
Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Lachlan Deck


On 16/05/2009, at 9:27 AM, Mike Schrag wrote:


public WORequest createRequest( String method,
  String aurl,
  String anHttpVersion,
  Map< String, ? extends List< String  
>> someHeaders,

  NSData content,
  Map< String, Object > someInfo )
{
	Map< String, List< String >> correctHeaders = new HashMap< String,  
List< String > >();


NSList nslist = null;
someHeaders.put( "foo", nslist ); // compile error
correctHeaders.put( "foo", nslist ); // no problems

NSMutableArray array = null;
someHeaders.put( "foo", array ); // compile error
correctHeaders.put( "foo", array ); // no problems

}

You don't need extends for interfaces AFAIK.
Not sure what you're showing here, but you are correct that you  
don't need extends to control the value you put into the map.  You  
need the extends to control what generic impls you can pass in as  
the PARAMETER to the method.


Ugh - yeah. Helps if I save the editor :-)

So if you're showing that a Map> allows you to  
put a subtype of List as the value, I totally agree.  The problem is  
that a Map> is NOT assignable to a  
Map> -- this is the Integer vs Number problem*,  
and it's not a typesafe operation.


Right - lights are back on now. Cool.

* I keep this in my Stickies in like 24pt type, so every time I say  
"WTF CAN'T I DO THAT", i can run stickies and remind myself:


WHY IT'S ILLEGAL TO UPCAST GENERICS

Map integers = new HashMap();
Map numbers = integers; // illegal
numbers.put("str", Long.valueOf(1)); // and this is why

now a long is in integers



Generics are great mostly - but there are times when it's just  
downright annoying :-).


with regards,
--

Lachlan Deck

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread David Holt

Works fine in Leopard, so I would guess it's a Tiger vs. Leopard issue.

David

On 15-May-09, at 2:24 PM, David Holt wrote:

Does it work with Tiger? I can't get any classes to load. JD-GUI  
doesn't work with Tiger as far as I can tell, so it might be the  
same issue.


David

On 15-May-09, at 1:51 PM, Chuck Hill wrote:



On May 15, 2009, at 11:16 AM, Henrique Prange wrote:


Hi list,

Just to inform the Java Decompiler [1] plug-in for Eclipse is  
now available for Mac OS X. I have tried and it seems pretty good.


[1]http://java.decompiler.free.fr/



Bye bye Jadclipse!

Thanks for the heads up.


Chuck


--
Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ 
programmingosx%40mac.com


This email sent to programming...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/programmingosx 
%40mac.com


This email sent to programming...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Mike Schrag
	Map< String, List< String >> correctHeaders = new HashMap< String,  
List< String > >();
btw, this is what i was saying that the only typesafe way to do this  
is to copy the original headers -- so you would do new HashMapList>(originalHeaders) and then you'd have a properly typesafe  
> that you can happily insert into whatever  
List subtypes you want inside of createRequest. But it takes a  
copy to do it, which kind of sucks.


ms

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Mike Schrag

public WORequest createRequest( String method,
   String aurl,
   String anHttpVersion,
   Map< String, ? extends List< String  
>> someHeaders,

   NSData content,
   Map< String, Object > someInfo )
{
	Map< String, List< String >> correctHeaders = new HashMap< String,  
List< String > >();


NSList nslist = null;
someHeaders.put( "foo", nslist ); // compile error
correctHeaders.put( "foo", nslist ); // no problems

NSMutableArray array = null;
someHeaders.put( "foo", array ); // compile error
correctHeaders.put( "foo", array ); // no problems

}

You don't need extends for interfaces AFAIK.
Not sure what you're showing here, but you are correct that you don't  
need extends to control the value you put into the map.  You need the  
extends to control what generic impls you can pass in as the PARAMETER  
to the method.  So if you're showing that a Map>  
allows you to put a subtype of List as the value, I totally agree.   
The problem is that a Map> is NOT assignable  
to a Map> -- this is the Integer vs Number  
problem*, and it's not a typesafe operation.  In your example, map a  
Map> and try to pass that into createRequest  
-- it will work, but you can't insert into it, because you have no  
idea precisely what subtype of List the generic was actually written  
for -- the "? extends" screws your ability to insert into it in a  
typesafe way.  If you remove the "? extends" you can put any list  
subtype into the value, but you can't pass in a generic that is  
declared as anything except PRECISELY >, which  
causes the problem below:



If the method sig changes, it's annoying to people passing values in,


Map< String, NSArray< String >> someHeaders = null;
Map< String, Object > someInfo = null;

createRequest( "foo", "url", "1", someHeaders, null, someInfo );

No compile errors.

I'm not convinced that fixing the method signature would break  
anything for anyone at all.


public static void doSomething() {
		Map> testMap = new HashMapLinkedList>();

doSomethingElse(testMap);
}

public static void doSomethingElse(Map> test) {

}

this is a compile error .. if the method signature removes the ?  
extends List you can't pass in a generic that has a V that is  
explicitly declared as a subtype of List, you can only pass in a V  
that is declared as List.


ms


* I keep this in my Stickies in like 24pt type, so every time I say  
"WTF CAN'T I DO THAT", i can run stickies and remind myself:


WHY IT'S ILLEGAL TO UPCAST GENERICS

Map integers = new HashMap();
Map numbers = integers; // illegal
numbers.put("str", Long.valueOf(1)); // and this is why

now a long is in integers ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Curly Generics Question - Update

2009-05-15 Thread Lachlan Deck

On 15/05/2009, at 10:48 PM, Mike Schrag wrote:

Yeah this is a tricky one ... But you're right that the API is "?  
extends List" so you can pass in NSArray, which is a  
pretty common implementation.  You also can't necessarily just  
assume people can declare their vars as List instead of  
NSArray because you don't know where that var came from (the  
general case is that you really do want it to be enforced as  
>).  Basically, this method declaration  
makes it easy and flexible for people passing in params, but it  
makes it really complicated to add values to that map like Andrew is  
finding.  The deal is that the signature is "? extends List"  
this does NOT mean you can just put anything that extends  
List into the value, rather, it means you can pass in any  
generic that has a List that is a subclass of List.  The  
distinction is that if you pass in NSArray as the list, you  
can't just put any list into it -- it explicitly has to be an  
NSArray, but inside that method, you have no idea what the  
ACTUAL type is.  So Andrew's code is failing because the list type  
he's putting in is whatever singletonList returns, but that's not  
guaranteed to be match the passed-in type.


The problem is that if the method sig is changed to List> then you have to do a copy operation to convert  
> to > ... Tough call  
on that one.


No, no - you wouldn't have to do that at all. This is a bug.

// test interface
private static interface NSList extends List
{
public int count();
}

@Override
public WORequest createRequest( String method,
String aurl,
String anHttpVersion,
Map< String, ? extends List< String  
>> someHeaders,

NSData content,
Map< String, Object > someInfo )
{
	Map< String, List< String >> correctHeaders = new HashMap< String,  
List< String > >();


NSList nslist = null;
someHeaders.put( "foo", nslist ); // compile error
correctHeaders.put( "foo", nslist ); // no problems

NSMutableArray array = null;
someHeaders.put( "foo", array ); // compile error
correctHeaders.put( "foo", array ); // no problems

}

You don't need extends for interfaces AFAIK.


If the method sig changes, it's annoying to people passing values in,


Map< String, NSArray< String >> someHeaders = null;
Map< String, Object > someInfo = null;

createRequest( "foo", "url", "1", someHeaders, null, someInfo );

No compile errors.

I'm not convinced that fixing the method signature would break  
anything for anyone at all.


but as it stands, i'm not sure it's possible to put values INTO it  
inside this method.


ms


with regards,
--

Lachlan Deck

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread Q


On 16/05/2009, at 6:51 AM, Chuck Hill wrote:



On May 15, 2009, at 11:16 AM, Henrique Prange wrote:


Hi list,

Just to inform the Java Decompiler [1] plug-in for Eclipse is now  
available for Mac OS X. I have tried and it seems pretty good.


[1]http://java.decompiler.free.fr/



Bye bye Jadclipse!

Thanks for the heads up.


Just be careful, you will still want to keep both on hand. I have  
noticed some rare, but nasty errors from JD.


Check out WOMessage.setUserInfo() from WO54 for an example.

--
Seeya...Q

Quinton Dolan - qdo...@gmail.com
Gold Coast, QLD, Australia (GMT+10)
Ph: +61 419 729 806



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread David Holt
Does it work with Tiger? I can't get any classes to load. JD-GUI  
doesn't work with Tiger as far as I can tell, so it might be the same  
issue.


David

On 15-May-09, at 1:51 PM, Chuck Hill wrote:



On May 15, 2009, at 11:16 AM, Henrique Prange wrote:


Hi list,

Just to inform the Java Decompiler [1] plug-in for Eclipse is now  
available for Mac OS X. I have tried and it seems pretty good.


[1]http://java.decompiler.free.fr/



Bye bye Jadclipse!

Thanks for the heads up.


Chuck


--
Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/programmingosx 
%40mac.com


This email sent to programming...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread Chuck Hill


On May 15, 2009, at 11:16 AM, Henrique Prange wrote:


Hi list,

Just to inform the Java Decompiler [1] plug-in for Eclipse is now  
available for Mac OS X. I have tried and it seems pretty good.


[1]http://java.decompiler.free.fr/



Bye bye Jadclipse!

Thanks for the heads up.


Chuck


--
Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Constraint error when I don't think I should have one.

2009-05-15 Thread Chuck Hill
EOF can change the order that these are sent to the database.  Is  
there any chance that the order that is causing the error is not the  
order you show in your message?


Chuck

On May 15, 2009, at 1:16 PM, Lon Varscsak wrote:


Sorry, it's really not that confusing

OrderHeader
->> OrderDetailSales
  -> OrderDetailCost

The values in the objects are fine, the pk's are fine, the insert  
order appears to be fine (OrderHeader then OrderDetailSales then  
OrderDetailCost) so the db constraint should be a problem, but for  
some reason SOMETIMES it is.  It's weird, I can run it once and  
everything gets into the database fine, I can run it again (with no  
code changes) and it will fail.


-Lon

On Fri, May 15, 2009 at 12:35 PM, David Avendasora > wrote:


On May 15, 2009, at 3:09 PM, Lon Varscsak wrote:

This is a complete shot in the dark, but how does Sybase handle  
constraints within one transaction? Would the OrderHeader insert  
have to be committed before you can issue an INSERT into a related  
table?


As long as it's in the transaction it should be okay.  I'm wondering  
if it's not really in a transaction...but in the end I end up with  
no rows as I would expect in an error condition.


If that's not it, what is the actual order_detlcost_ordhdr  
constraint? Is it a compound FK?


It's just based on order_number.

Also, I don't know your business case, but It seems odd that the  
OrderDetailCost entity would be related directly to the OrderHeader  
entity and not to the OrderDetail entity.


Technically it's not, it's really directly related to  
OrderDetailSale (which is inserted before the cost record as  
well...I just left out that detail), but I didn't setup the foreign  
keys (that was long before me).  However, the foreign key itself has  
been in place for over a decade, and I have old code (Obj-c) that is  
fine.


This is confusing. Maybe you can give a more detailed model without  
leaving anything out?



I'm really wondering if this has to do with the way jdbc/jconnect  
deal with autocommit.


Well, it appears that there was at one time an EOF SybasePlugIn in  
Wonder that was created specifically to deal with PK generation  
issues. See: http://osdir.com/ml/web.webobjects.woproject.cvs/2003-09/msg00166.html


It doesn't appear to be part of the Wonder source anymore, though.

Dave


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net


--
Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Constraint error when I don't think I should have one.

2009-05-15 Thread Lon Varscsak
Sorry, it's really not that confusing

OrderHeader
->> OrderDetailSales
  -> OrderDetailCost

The values in the objects are fine, the pk's are fine, the insert order
appears to be fine (OrderHeader then OrderDetailSales then OrderDetailCost)
so the db constraint should be a problem, but for some reason SOMETIMES it
is.  It's weird, I can run it once and everything gets into the database
fine, I can run it again (with no code changes) and it will fail.

-Lon

On Fri, May 15, 2009 at 12:35 PM, David Avendasora <
webobje...@avendasora.com> wrote:

>
> On May 15, 2009, at 3:09 PM, Lon Varscsak wrote:
>
>  This is a complete shot in the dark, but how does Sybase handle
>> constraints within one transaction? Would the OrderHeader insert have to be
>> committed before you can issue an INSERT into a related table?
>>
>> As long as it's in the transaction it should be okay.  I'm wondering if
>> it's not really in a transaction...but in the end I end up with no rows as I
>> would expect in an error condition.
>>
>> If that's not it, what is the actual order_detlcost_ordhdr constraint? Is
>> it a compound FK?
>>
>> It's just based on order_number.
>>
>> Also, I don't know your business case, but It seems odd that the
>> OrderDetailCost entity would be related directly to the OrderHeader entity
>> and not to the OrderDetail entity.
>>
>> Technically it's not, it's really directly related to OrderDetailSale
>> (which is inserted before the cost record as well...I just left out that
>> detail), but I didn't setup the foreign keys (that was long before me).
>>  However, the foreign key itself has been in place for over a decade, and I
>> have old code (Obj-c) that is fine.
>>
>
> This is confusing. Maybe you can give a more detailed model without leaving
> anything out?
>
>  I'm really wondering if this has to do with the way jdbc/jconnect deal
>> with autocommit.
>>
>
> Well, it appears that there was at one time an EOF SybasePlugIn in Wonder
> that was created specifically to deal with PK generation issues. See:
> http://osdir.com/ml/web.webobjects.woproject.cvs/2003-09/msg00166.html
>
> It doesn't appear to be part of the Wonder source anymore, though.
>
> Dave
>
>
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Constraint error when I don't think I should have one.

2009-05-15 Thread David Avendasora


On May 15, 2009, at 3:09 PM, Lon Varscsak wrote:

This is a complete shot in the dark, but how does Sybase handle  
constraints within one transaction? Would the OrderHeader insert  
have to be committed before you can issue an INSERT into a related  
table?


As long as it's in the transaction it should be okay.  I'm wondering  
if it's not really in a transaction...but in the end I end up with  
no rows as I would expect in an error condition.


If that's not it, what is the actual order_detlcost_ordhdr  
constraint? Is it a compound FK?


It's just based on order_number.

Also, I don't know your business case, but It seems odd that the  
OrderDetailCost entity would be related directly to the OrderHeader  
entity and not to the OrderDetail entity.


Technically it's not, it's really directly related to  
OrderDetailSale (which is inserted before the cost record as  
well...I just left out that detail), but I didn't setup the foreign  
keys (that was long before me).  However, the foreign key itself has  
been in place for over a decade, and I have old code (Obj-c) that is  
fine.


This is confusing. Maybe you can give a more detailed model without  
leaving anything out?


I'm really wondering if this has to do with the way jdbc/jconnect  
deal with autocommit.


Well, it appears that there was at one time an EOF SybasePlugIn in  
Wonder that was created specifically to deal with PK generation  
issues. See: http://osdir.com/ml/web.webobjects.woproject.cvs/2003-09/msg00166.html


It doesn't appear to be part of the Wonder source anymore, though.

Dave

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Constraint error when I don't think I should have one.

2009-05-15 Thread Lon Varscsak
>
> This is a complete shot in the dark, but how does Sybase handle constraints
> within one transaction? Would the OrderHeader insert have to be committed
> before you can issue an INSERT into a related table?
>

As long as it's in the transaction it should be okay.  I'm wondering if it's
not really in a transaction...but in the end I end up with no rows as I
would expect in an error condition.

If that's not it, what is the actual order_detlcost_ordhdr constraint? Is it
> a compound FK?
>

It's just based on order_number.


> Also, I don't know your business case, but It seems odd that the
> OrderDetailCost entity would be related directly to the OrderHeader entity
> and not to the OrderDetail entity.
>

Technically it's not, it's really directly related to OrderDetailSale (which
is inserted before the cost record as well...I just left out that detail),
but I didn't setup the foreign keys (that was long before me).  However, the
foreign key itself has been in place for over a decade, and I have old code
(Obj-c) that is fine.

I'm really wondering if this has to do with the way jdbc/jconnect deal with
autocommit.

-Lon
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

[OT] JD-Eclipse plug-in available for Mac OS X

2009-05-15 Thread Henrique Prange

Hi list,

Just to inform the Java Decompiler [1] plug-in for Eclipse is now  
available for Mac OS X. I have tried and it seems pretty good.


[1]http://java.decompiler.free.fr/

Cheers,

Henrique
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Constraint error when I don't think I should have one.

2009-05-15 Thread David Avendasora
This is a complete shot in the dark, but how does Sybase handle  
constraints within one transaction? Would the OrderHeader insert have  
to be committed before you can issue an INSERT into a related table?


If that's not it, what is the actual order_detlcost_ordhdr constraint?  
Is it a compound FK?


Also, I don't know your business case, but It seems odd that the  
OrderDetailCost entity would be related directly to the OrderHeader  
entity and not to the OrderDetail entity.


Dave

On May 15, 2009, at 1:47 PM, Lon Varscsak wrote:

I have an object graph that's being saved and it seems okay.  I have  
an OrderHeader object and an OrderDetailCost object where the  
foreign key for OrderDetailCost requires OrderHeader to exist.


Here's the sql (snipped):

May 15 10:05:00 DataBuilder[2500] DEBUG NSLog  -  === Begin Internal  
Transaction
May 15 10:05:00 DataBuilder[2500] DEBUG NSLog  -   
evaluateExpression: $SybaseExpression: "INSERT INTO  
production..order_header(personalization_amount, ...snip
May 15 10:05:00 DataBuilder[2500] DEBUG NSLog  -   
evaluateExpression: $SybaseExpression: "INSERT INTO  
production..order_detail_costs(duty_tax_cost, ...snip


The primary key values in both tables are correct (the sql that I  
snipped shows that)...but I get a constraint error saying that  
order_detail_costs expects to have order_header inserted first.  I'm  
stumped, because that's exactly what it's doing.


May 15 10:05:00 DataBuilder[2500] INFO   
er.transaction.adaptor.Exceptions  - Database Exception occured:  
com.webobjects.eoaccess.EOGeneralAdaptorException:  
EvaluateExpression failed: $SybaseExpression: "INSERT INTO  
production..order_detail_costs(duty_tax_cost ...snip...:
Next exception:SQL State:23000 -- error code: 546 -- msg:  
Foreign key constraint violation occurred, dbname =  'production',  
table name = 'production..order_detail_costs', constraint name =  
'order_detlcost_ordhdr'.




Any ideas?

Thanks,

Lon

Using:
Sybase 12.5.4 (with the latest jConnect...their jdbc driver)

WebObjects 5.4.3 with Wonder from a couple of weeks ago


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com

This email sent to webobje...@avendasora.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Constraint error when I don't think I should have one.

2009-05-15 Thread Lon Varscsak
I have an object graph that's being saved and it seems okay.  I have an
OrderHeader object and an OrderDetailCost object where the foreign key for
OrderDetailCost requires OrderHeader to exist.

Here's the sql (snipped):

May 15 10:05:00 DataBuilder[2500] DEBUG NSLog  -  === Begin Internal
Transaction

May 15 10:05:00 DataBuilder[2500] DEBUG NSLog  -  evaluateExpression:
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: [OT] Safari Problem

2009-05-15 Thread John Ours
Oh my!  You're right   Looks like I've got my work cut out for  
me today...





On May 15, 2009, at 9:36 AM, Phillip Hutchings wrote:

I suggest you check the source code of your front page, Safari is  
right.


On Sat, May 16, 2009 at 01:31, John Ours  wrote:
OK, totally off topic and a shot in the dark, but I figured I'd ask  
some of

the most knowledgeable people I know...

One of my sites (non-WO) is throwing a "Malicious Site" warning in  
Safari
only.  The site is www.hollywoodposterauction.com and the google  
message
seems to have it confused with a site called www.you-found-it.com.   
WTF?
 The google safe browsing page lists my site as clean (attached) so  
my guess

is that it's got the two sites confused somehow.  I've got my hosting
company looking into it as well, but I thought I'd see if anyone  
here had a

guess...

Thanks!

John






 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/sitharus%40sitharus.com

This email sent to sitha...@sitharus.com





--
Phillip Hutchings
http://www.sitharus.com/


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [OT] Safari Problem

2009-05-15 Thread Phillip Hutchings
I suggest you check the source code of your front page, Safari is right.

On Sat, May 16, 2009 at 01:31, John Ours  wrote:
> OK, totally off topic and a shot in the dark, but I figured I'd ask some of
> the most knowledgeable people I know...
>
> One of my sites (non-WO) is throwing a "Malicious Site" warning in Safari
> only.  The site is www.hollywoodposterauction.com and the google message
> seems to have it confused with a site called www.you-found-it.com.  WTF?
>  The google safe browsing page lists my site as clean (attached) so my guess
> is that it's got the two sites confused somehow.  I've got my hosting
> company looking into it as well, but I thought I'd see if anyone here had a
> guess...
>
> Thanks!
>
> John
>
>
>
>
>
>
>  ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/sitharus%40sitharus.com
>
> This email sent to sitha...@sitharus.com
>



-- 
Phillip Hutchings
http://www.sitharus.com/
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Mike Schrag
well, no matter what you do, i think you're going to throw out type  
safety, so inside the method, you could just cast the headers to  
> :


Map> badCast = (MapList>)headers;

badCast.put("a", new LinkedList());

ms

On May 15, 2009, at 8:56 AM, Jim Kinsey wrote:


Hi Andrew,

what the calling method ought to be doing though is declaring the  
list it passes as Map> and hiding the  
concrete List implementation, negating the need for the wildcard.


I tried it with a concrete implementation of List as well, but this  
also raised an error in a similar fashion.  It's got me.  You are  
right, I could create a new Map and use that instead as it should  
work, but that would be rather inelegant.


I was meaning that as more of an example of why, possibly, the  
"bug" (I'm not sure it really can be called that yet) exists - that  
there was some calling code somewhere in the WO source which was  
passing in something declared a bit too concrete, so it got "fixed"  
by wildcarding the List parameter on createRequest rather than  
changing the declaration in the calling code to work to an interface.


I think the only real solution which still involves overriding  
createRequest is to override without generics and suppress the  
warning; if you want to do lots of work within the overridden  
createRequest and like to have the generic type checking then you  
could pass this work on to a different method with appropriately  
generic arguments:


@SuppressWarnings("unchecked")
@Override
public WORequest createRequest(String method, String aurl,
String anHTTPVersion,
Map someHeaders, NSData content,
Map someInfo) {
		return genericCreateRequest(method, aurl, anHTTPVersion,  
someHeaders, content, someInfo);

}

private WORequest genericCreateRequest(String method, String aurl,
String anHTTPVersion,
Map> someHeaders, NSData content,
Map someInfo) {

someHeaders.put("foo", 
Collections.singletonList("bar"));

		return super.createRequest(method, aurl, anHTTPVersion,  
someHeaders, content, someInfo);

}

Cheers,

Jim





Could this be considered a bug in WOApplication?


Yes, I think it is not quite right.

cheers.

___
Andrew Lindesay
www.lindesay.co.nz




http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and may contain  
personal views which are not the views of the BBC unless  
specifically stated.

If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in  
reliance on it and notify the sender immediately.

Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com

This email sent to msch...@mdimension.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Curly Generics Question - Update

2009-05-15 Thread Jim Kinsey

Hi Andrew,

what the calling method ought to be doing though is declaring the  
list it passes as Map> and hiding the concrete  
List implementation, negating the need for the wildcard.


I tried it with a concrete implementation of List as well, but this  
also raised an error in a similar fashion.  It's got me.  You are  
right, I could create a new Map and use that instead as it should  
work, but that would be rather inelegant.


I was meaning that as more of an example of why, possibly, the  
"bug" (I'm not sure it really can be called that yet) exists - that  
there was some calling code somewhere in the WO source which was  
passing in something declared a bit too concrete, so it got "fixed" by  
wildcarding the List parameter on createRequest rather than changing  
the declaration in the calling code to work to an interface.


I think the only real solution which still involves overriding  
createRequest is to override without generics and suppress the  
warning; if you want to do lots of work within the overridden  
createRequest and like to have the generic type checking then you  
could pass this work on to a different method with appropriately  
generic arguments:


@SuppressWarnings("unchecked")
@Override
public WORequest createRequest(String method, String aurl,
String anHTTPVersion,
Map someHeaders, NSData content,
Map someInfo) {
		return genericCreateRequest(method, aurl, anHTTPVersion,  
someHeaders, content, someInfo);

}

private WORequest genericCreateRequest(String method, String aurl,
String anHTTPVersion,
Map> someHeaders, NSData content,
Map someInfo) {

someHeaders.put("foo", 
Collections.singletonList("bar"));

		return super.createRequest(method, aurl, anHTTPVersion, someHeaders,  
content, someInfo);

}

Cheers,

Jim





Could this be considered a bug in WOApplication?


Yes, I think it is not quite right.

cheers.

___
Andrew Lindesay
www.lindesay.co.nz




http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Curly Generics Question - Update

2009-05-15 Thread Mike Schrag
Yeah this is a tricky one ... But you're right that the API is "?  
extends List" so you can pass in NSArray, which is a  
pretty common implementation.  You also can't necessarily just assume  
people can declare their vars as List instead of  
NSArray because you don't know where that var came from (the  
general case is that you really do want it to be enforced as NSArray>).  Basically, this method declaration makes it easy  
and flexible for people passing in params, but it makes it really  
complicated to add values to that map like Andrew is finding.  The  
deal is that the signature is "? extends List" this does NOT  
mean you can just put anything that extends List into the  
value, rather, it means you can pass in any generic that has a List  
that is a subclass of List.  The distinction is that if you  
pass in NSArray as the list, you can't just put any list into  
it -- it explicitly has to be an NSArray, but inside that  
method, you have no idea what the ACTUAL type is.  So Andrew's code is  
failing because the list type he's putting in is whatever  
singletonList returns, but that's not guaranteed to be match the  
passed-in type.


The problem is that if the method sig is changed to List> then you have to do a copy operation to convert NSArray> to > ... Tough call on that  
one.  If the method sig changes, it's annoying to people passing  
values in, but as it stands, i'm not sure it's possible to put values  
INTO it inside this method.


ms

On May 15, 2009, at 8:14 AM, Jim Kinsey wrote:


Hi Andrew,

I find it odd that the map should have ? extends List as a  
parameter as the extension ought to be unnecessary (assuming callers  
are working to the List interface) - any List implementation with a  
String parameter fulfills List. I like generics too, but  
have come across similarly gnarly counter-intuitive things. I find  
that often if you think about them enough they eventually make  
sense, but this one has me stumped!


I see it came from overriding the WOApplication method - and if you  
don't include the parameter in this way you get a compilation error.  
This can be made to go away by overriding without providing the  
generic parameters, which then produces a warning which you can  
annotate away:


@SuppressWarnings("unchecked")
@Override
public WORequest createRequest(String method, String aurl,
String anHTTPVersion,
Map someHeaders, NSData content,
Map someInfo) {

someHeaders.put("foo", 
Collections.singletonList("bar"));

I suppose you might want to use this kind of wildcard extension if  
you want to pass a Map which declares an extension of List  
elsewhere; e.g. if there was a calling method which was passing a  
variable declared as Map> to this  
method there would be a compilation error without the wildcard;  
arguably what the calling method ought to be doing though is  
declaring the list it passes as Map> and hiding  
the concrete List implementation, negating the need for the wildcard.


e.g. works to impl rather than interface:

			NSMutableDictionary> someHeaders =  
new NSMutableDictionary>();
		someHeaders.setObjectForKey(new NSMutableArray("bar"),  
"foo");
		WORequest req = createRequest(method, aurl, anHTTPVersion,  
someHeaders, content, someInfo);


vs. working just to interface:

		Map> someHeaders = new  
NSMutableDictionary>();

someHeaders.put("foo", new NSMutableArray("bar"));
		WORequest req = createRequest(method, aurl, anHTTPVersion,  
someHeaders, content, someInfo);


Both compile to current WOApplication API; former would not if the  
wildcard were to be removed from createRequest.


Could this be considered a bug in WOApplication? I believe if this  
method declaration had the wildcard extension removed and any  
calling methods which need to be were fixed to work to interface  
rather than implementation then this problem would go away and  
createRequest could be overridden and worked with generically. Easy  
to say - I still find myself preferring to work directly with NS  
implementations for key-value-coding / EOQualifiers...


Cheers,

Jim

On 15 May 2009, at 03:54, Andrew Lindesay wrote:

Sorry wrong method; I obviously meant "put" rather than "add" in  
this example and "The method put(String,List) in the type  
Map> is not applicable  
for the arguments (String,List)" is the problem.


I've been working with generics for quite a while (and quite like  
them) but this one has me stumped!


___
Andrew Lindesay
www.lindesay.co.nz

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jim.kinsey%40bbc.co.uk

This email sent to jim.kin...@bbc.co.uk



http://www.bbc.co.uk
This e-mail (and any atta

Re: Curly Generics Question - Update

2009-05-15 Thread Andrew Lindesay

Hello Jim;

Thanks for the reply.

what the calling method ought to be doing though is declaring the  
list it passes as Map> and hiding the concrete  
List implementation, negating the need for the wildcard.


I tried it with a concrete implementation of List as well, but this  
also raised an error in a similar fashion.  It's got me.  You are  
right, I could create a new Map and use that instead as it should  
work, but that would be rather inelegant.



Could this be considered a bug in WOApplication?


Yes, I think it is not quite right.

cheers.

___
Andrew Lindesay
www.lindesay.co.nz

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Curly Generics Question - Update

2009-05-15 Thread Jim Kinsey

Hi Andrew,

I find it odd that the map should have ? extends List as a  
parameter as the extension ought to be unnecessary (assuming callers  
are working to the List interface) - any List implementation with a  
String parameter fulfills List. I like generics too, but have  
come across similarly gnarly counter-intuitive things. I find that  
often if you think about them enough they eventually make sense, but  
this one has me stumped!


I see it came from overriding the WOApplication method - and if you  
don't include the parameter in this way you get a compilation error.  
This can be made to go away by overriding without providing the  
generic parameters, which then produces a warning which you can  
annotate away:


@SuppressWarnings("unchecked")
@Override
public WORequest createRequest(String method, String aurl,
String anHTTPVersion,
Map someHeaders, NSData content,
Map someInfo) {

someHeaders.put("foo", 
Collections.singletonList("bar"));

I suppose you might want to use this kind of wildcard extension if you  
want to pass a Map which declares an extension of List elsewhere; e.g.  
if there was a calling method which was passing a variable declared as  
Map> to this method there would be a  
compilation error without the wildcard; arguably what the calling  
method ought to be doing though is declaring the list it passes as  
Map> and hiding the concrete List implementation,  
negating the need for the wildcard.


e.g. works to impl rather than interface:

			NSMutableDictionary> someHeaders =  
new NSMutableDictionary>();

someHeaders.setObjectForKey(new NSMutableArray("bar"), 
"foo");
		WORequest req = createRequest(method, aurl, anHTTPVersion,  
someHeaders, content, someInfo);


vs. working just to interface:

		Map> someHeaders = new  
NSMutableDictionary>();

someHeaders.put("foo", new NSMutableArray("bar"));
		WORequest req = createRequest(method, aurl, anHTTPVersion,  
someHeaders, content, someInfo);


Both compile to current WOApplication API; former would not if the  
wildcard were to be removed from createRequest.


Could this be considered a bug in WOApplication? I believe if this  
method declaration had the wildcard extension removed and any calling  
methods which need to be were fixed to work to interface rather than  
implementation then this problem would go away and createRequest could  
be overridden and worked with generically. Easy to say - I still find  
myself preferring to work directly with NS implementations for key- 
value-coding / EOQualifiers...


Cheers,

Jim

On 15 May 2009, at 03:54, Andrew Lindesay wrote:

Sorry wrong method; I obviously meant "put" rather than "add" in  
this example and "The method put(String,List) in the type  
Map> is not applicable for  
the arguments (String,List)" is the problem.


I've been working with generics for quite a while (and quite like  
them) but this one has me stumped!


___
Andrew Lindesay
www.lindesay.co.nz

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jim.kinsey%40bbc.co.uk

This email sent to jim.kin...@bbc.co.uk



http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com