comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* IOException after Socket.connect() - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6edbb4e109df50fe
* java applet network - 5 messages, 5 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e7c700cb1476b929
* User authentication in Tomcat -- best practices? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c44423e9b8a4e198
* XPATH in websphere - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a213f16a95f88b25
* Classes ending with semi-colon - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ac79b60dc00d846
* PrintJob.setName() equivalent in DocPrintJob - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/388f18f8480ef76
* Detecting double click with MouseListener - 5 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7acf887f3c6b02cd
* ATDT 123456789 How?? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c755fca6811fa45f
* quick help with vb to java transalation - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4fe61018e7c6b66b
* Tomcat + Eclipse setup - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/217b0f0d4770b747
* 1.5 howto - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f65789ac1abef909
* Different compilers = Different byte code? - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d6730b906587dde
* How to wait for multiple threads to finish - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d0cf1fcbe3125cb5
* Would like a preprocessor. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8d589c27ece424e
* mpeg iframes in JAI - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fa40eaf6b61d9982
* comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2002-12-28) - 1 
messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1dfbde0ee0a3558e
* java.lang.Set with elements of type java.lang.Set - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/81df6c6e14ce73d2
* Waiting for the end of multiple threads - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ea50a92c1a9cd2a
* Thread synchronization problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51dbef92f81ca351
  
==========================================================================
TOPIC: IOException after Socket.connect()
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6edbb4e109df50fe
==========================================================================

== 1 of 2 ==
Date:   Mon,   Aug 30 2004 11:26 pm
From: Gordon Beaton <[EMAIL PROTECTED]> 

On Mon, 30 Aug 2004 23:18:42 GMT, alessandro wrote:
> Hi, I have a problem calling connect(): it throws an IOException.
> The server has not already started, but I setted a long timeout.
> Does the socket fail just because it doesnt find the server, or does
> it wait till timeout has elapsed?

The timeout doesn't mean "wait this long until there is a server to
connect to" it means "wait at most this long before reporting
failure". Of course if the attempt fails or succeeds before that, it
will return sooner.

If the host is running and reachable from your client host, but there
is no listening server, connect() will fail more or less immediately.
The remote OS will refuse the connection attempt, at which point
connect() has done all it can do.

If you want to continue trying until the server process comes up,
have your application sleep for a while before trying again.

/gordon

-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e



== 2 of 2 ==
Date:   Tues,   Aug 31 2004 2:14 am
From: "alessandro" <[EMAIL PROTECTED]> 


>
> The timeout doesn't mean "wait this long until there is a server to
> connect to" it means "wait at most this long before reporting
> failure". Of course if the attempt fails or succeeds before that, it
> will return sooner.

Uh, I thought this was the meaning. I'm not an expert in network
programming...

> If the host is running and reachable from your client host, but there
> is no listening server, connect() will fail more or less immediately.
> The remote OS will refuse the connection attempt, at which point
> connect() has done all it can do.

In fact it failed immediately.

> If you want to continue trying until the server process comes up,
> have your application sleep for a while before trying again.

Ok, now it works! Thank you!

> /gordon
>
> --
> [  do not email me copies of your followups  ]
> g o r d o n + n e w s @  b a l d e r 1 3 . s e

Alessandro






==========================================================================
TOPIC: java applet network
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e7c700cb1476b929
==========================================================================

== 1 of 5 ==
Date:   Mon,   Aug 30 2004 11:46 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 31 Aug 2004 01:22:17 -0400, apple wrote:

> To all java 

Wow!  You've suddenly reverted to English.
(or a close facsimile thereof.. java->Java)

>..zu tou bing:
> ta ma de wang ba dan, ni men gou yen kan ren di, si feng zi.

..but I think this sums you up.

Start putting more effort into structuring 
your sentences, they look like a dog's 
breakfast and are difficult to read quickly.

If you expect help in a Java (read technical) 
forum, you need to put more effort in.  Not 
just into the sentence structure, but also..

Do your research, mention results of 
research in you question.
Provide an example that displays the 
behaviour you are attempting to fix.
State 
a) What you expected
b) What happened.

If you do not do these things, expect
(much) more derision.

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 2 of 5 ==
Date:   Tues,   Aug 31 2004 12:27 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

apple <[EMAIL PROTECTED]> scribbled the following:
> To all java zu tou bing:
> ta ma de wang ba dan, ni men gou yen kan ren di, si feng zi. 

Could you please try that again in Earthern? =)

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"The day Microsoft makes something that doesn't suck is probably the day they
start making vacuum cleaners."
   - Ernst Jan Plugge



== 3 of 5 ==
Date:   Tues,   Aug 31 2004 1:34 am
From: "apple" <[EMAIL PROTECTED]> 

ok, thank you for your advice.




== 4 of 5 ==
Date:   Tues,   Aug 31 2004 2:56 am
From: Morten Alver <[EMAIL PROTECTED]> 

> Remember that English is, in essence, the language out of which successful
> Java programs are written.

Aha, that must be why my localized "Hello world" application fails to 
compile (thus it it quite unsuccessful):

klasse Hallo {

   offentlig statisk tom hoved(Streng[] arg) {
     System.ut.skrivLinje("Hallo verden!");
   }

}


--
Morten



== 5 of 5 ==
Date:   Tues,   Aug 31 2004 3:17 am
From: Babu Kalakrishnan <[EMAIL PROTECTED]> 

Paul Lutus wrote:

>>I am posting this message because I noticed the ridicule in identical
>>responses by you to *two* different questions from the same user. From my
>>past interactions with you, I don't really expect you to think about this
>>rationally and apologize for your remarks which were in bad taste,
> 
> 
> You need to rethink your bankrupt position.
> 

On re-reading the thread, I realize that I did over-react, and the wordings
of my message were a little overboard - my apologies.

However the points I would still try to make are :

a) Sarcasm is fine occasionally, but repeating the same in the second message of
the thread as well as in another message to the same user in a totally unrelated
thread does look to a third party as if all you're trying to do is put someone
down because he can't frame a question in proper English.

b) In Usenet there is never a need that you have to answer every question that
is asked. If you think you can offer help in a problem, by all means do so -
the person who asked the question would be grateful for it. But if you cannot
understand the question or the question is something that you probably don't
know the answer to (or don't care to answer), you could simply ignore it 
altogether and move on to the next instead posting a condescending reply which
doesn't help in anyway to solve the OP's problem. Would at least save on
bandwidth.

BK




==========================================================================
TOPIC: User authentication in Tomcat -- best practices?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c44423e9b8a4e198
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 12:25 am
From: [EMAIL PROTECTED] (Eduardo) 

Thanks for the responses everybody!

[EMAIL PROTECTED] (Eduardo) wrote in message news:<[EMAIL PROTECTED]>...
> Hello, I would like to know what do people use for
> user authentication in Tomcat.




==========================================================================
TOPIC: XPATH in websphere
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a213f16a95f88b25
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 12:36 am
From: [EMAIL PROTECTED] (Itamar Lev) 

I'm new to XPath in Java.
I've just downloaded the jaxen full version and
I want to start using it in websphere.
I put the jaxen-full.jar in my project but it still shows me errors.
I think that I need to add variables to the class path.
the WAS_50_PLUGINDIR/lib/xerces.jar is there already.

What should I do ?




==========================================================================
TOPIC: Classes ending with semi-colon
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ac79b60dc00d846
==========================================================================

== 1 of 3 ==
Date:   Tues,   Aug 31 2004 12:37 am
From: [EMAIL PROTECTED] (Razvan) 

> http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#18988


        Copy & paste from the above link:

ClassBody:
        { ClassBodyDeclarations }

       So, the class body has no semi-colon after it.
       Inside a class body you can define variables, member functions,
classes (nested classes) or interfaces. Look how the
"ClassBodyDeclarations" is declared:


ClassBodyDeclarations:
        ClassBodyDeclaration
        ClassBodyDeclarations ClassBodyDeclaration

ClassBodyDeclaration:
        ClassMemberDeclaration
        InstanceInitializer
        StaticInitializer
        ConstructorDeclaration

ClassMemberDeclaration:
        FieldDeclaration
        MethodDeclaration
        ClassDeclaration                                                
        InterfaceDeclaration
        ;                        


        That means that when defining "ClassMemberDeclaration" you can
end with semi-colon, but it does not say that you can do the same for
the enclosing class.




Regards,
Razvan



== 2 of 3 ==
Date:   Tues,   Aug 31 2004 12:38 am
From: [EMAIL PROTECTED] (Razvan) 

> It can cause some third-party tools to barf, though, so don't do it.

       Please name one that fails.



Regards,
Razvan



== 3 of 3 ==
Date:   Tues,   Aug 31 2004 1:18 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

P.Hill wrote:

> The array one is defined in the language spec, doesn't seem to appear
> in the spec:
>
[...]
> Array Initializer:
> http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html#11358
>
> My definition for good is that it matches the specified syntax, what
> definition of good are you using?

I believe that array initialisers are one of the places where the language
defined in the body of the JLS2 differs from the language defined in the final
chapter.  The body text does not allow the final ',' but chapter 18 does.
Grr...

I don't know which is intended to be normative, though the following comment,
from the beginning of Ch18, might be taken as some sort of hint -- by the
sufficiently credulous ;-)

=====
The grammar presented piecemeal in the preceding chapters is much better for
exposition, but it is not ideally suited as a basis for a parser. The grammar
presented in this chapter is the basis for the reference implementation.
=====

BTW, my take on the way that C and (maybe) Java allow the final ',' is that it
is good (i.e. recommended -- by me) for multiline initialisers:

    ... {
        'aaa',
        'bbb'
        // etc
        yyy,
    }

since lines may be added and removed without treating the last one as a
special-case.  It also (and this is an important point, IMO) simplifies code
generation usefully.

    -- chris







==========================================================================
TOPIC: PrintJob.setName() equivalent in DocPrintJob
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/388f18f8480ef76
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 12:45 am
From: staff <[EMAIL PROTECTED]> 

Hello all,

I was using PrintJob for printing, but now I have to use DocPrintJob. In
PrintJob there was method setName() for setting job name. In DocPrintJob
there is no such method, and I couldn't find any similar doing the same
thing.

Does anyone know how to set name of DocPrintJob?

Thanks in advance
Pawel Stawicki




==========================================================================
TOPIC: Detecting double click with MouseListener
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7acf887f3c6b02cd
==========================================================================

== 1 of 5 ==
Date:   Tues,   Aug 31 2004 1:03 am
From: Jacob <[EMAIL PROTECTED]> 

I can detect a docuble click using the MouseListener
interface and inspect the event.getClickCount().

However, at that point in time, the event has already
been classified as a single click (as the clickCount
is 1 the first time around).

My intention is to start action A on a single click
and action B on a double click. With a standard setup
I will get action A on a single click but action A + B
on a double click!

Seems like a delay is necessary in order to fully
classify the event. Is there a standard way to acheive
this?

Thanks.




== 2 of 5 ==
Date:   Tues,   Aug 31 2004 12:59 am
From: John <[EMAIL PROTECTED]> 

Jacob wrote:

> I can detect a docuble click using the MouseListener
> interface and inspect the event.getClickCount().
> 
> However, at that point in time, the event has already
> been classified as a single click (as the clickCount
> is 1 the first time around).
> 
> My intention is to start action A on a single click
> and action B on a double click. With a standard setup
> I will get action A on a single click but action A + B
> on a double click!
> 
> Seems like a delay is necessary in order to fully
> classify the event. Is there a standard way to acheive
> this?
> 
> Thanks.
> 

Let's say the double click listener calls the method 
handleDoubleClick(). In the single click listener, check the number of 
clicks, and if it is 2, call handleDoubleClick().

Do NOT start buggering about with delays and things or your UI code will 
degenerate into rubbish.

John



== 3 of 5 ==
Date:   Tues,   Aug 31 2004 1:07 am
From: staff <[EMAIL PROTECTED]> 

John wrote:

> Jacob wrote:
> 
>> I can detect a docuble click using the MouseListener
>> interface and inspect the event.getClickCount().
>> 
>> However, at that point in time, the event has already
>> been classified as a single click (as the clickCount
>> is 1 the first time around).
>> 
>> My intention is to start action A on a single click
>> and action B on a double click. With a standard setup
>> I will get action A on a single click but action A + B
>> on a double click!
>> 
>> Seems like a delay is necessary in order to fully
>> classify the event. Is there a standard way to acheive
>> this?
>> 
>> Thanks.
>> 
> 
> Let's say the double click listener calls the method
> handleDoubleClick(). In the single click listener, check the number of
> clicks, and if it is 2, call handleDoubleClick().

This is not a solution. When double clicking two events are generated. First
with clickCount = 1, second with cilckCount = 2.

Greetings
Pawel Stawicki



== 4 of 5 ==
Date:   Tues,   Aug 31 2004 1:12 am
From: "Niels Dybdahl" <[EMAIL PROTECTED]> 

> Let's say the double click listener calls the method
> handleDoubleClick(). In the single click listener, check the number of
> clicks, and if it is 2, call handleDoubleClick().
>
> Do NOT start buggering about with delays and things or your UI code will
> degenerate into rubbish.

The Java versions I have worked with (Sun), there is only one
mouseclickevent, and in the case of a double click, that event is fired
twice, once with a clickcount of 1 and once with a clickcount of 2. At the
time when the clickcount of 1 is present, there is no way to determine
whether the user will click once more.

One possible method is to select a singleclickaction which does not conflict
with the doubleclickaction. F.ex single click->selection, double
click->activation.

I have had a few cases where I wanted actions that did conflict. I did not
implement the delay, but changed the actions.

Niels Dybdahl





== 5 of 5 ==
Date:   Tues,   Aug 31 2004 1:27 am
From: John <[EMAIL PROTECTED]> 

staff wrote:

> John wrote:
> 
> 
>>Jacob wrote:
>>
>>
>>>I can detect a docuble click using the MouseListener
>>>interface and inspect the event.getClickCount().
>>>
>>>However, at that point in time, the event has already
>>>been classified as a single click (as the clickCount
>>>is 1 the first time around).
>>>
>>>My intention is to start action A on a single click
>>>and action B on a double click. With a standard setup
>>>I will get action A on a single click but action A + B
>>>on a double click!
>>>
>>>Seems like a delay is necessary in order to fully
>>>classify the event. Is there a standard way to acheive
>>>this?
>>>
>>>Thanks.
>>>
>>
>>Let's say the double click listener calls the method
>>handleDoubleClick(). In the single click listener, check the number of
>>clicks, and if it is 2, call handleDoubleClick().
> 
> 
> This is not a solution. When double clicking two events are generated. First
> with clickCount = 1, second with cilckCount = 2.
> 
> Greetings
> Pawel Stawicki

Ok, apologies. (and to OP).

John




==========================================================================
TOPIC: ATDT 123456789 How??
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c755fca6811fa45f
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 12:58 am
From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> 

"<- Chameleon ->" <[EMAIL PROTECTED]> writes:

> I know, there is a package javax.comm but I dont know anything else.

Well, that package has docs and examples which should explain what you
need to do.




==========================================================================
TOPIC: quick help with vb to java transalation
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4fe61018e7c6b66b
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 1:03 am
From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> 

[EMAIL PROTECTED] (Fred) writes:

> What are the java translations for the following VB declarations:
> 
> Public Declare Function FindWindow Lib "user32" 
>     Alias "FindWindowA" (ByVal lpClassName As String, 
>                          ByVal lpWindowName As String) As Long

public static native long findWindow(String lpClassName, String
lpWindowName);

> Public Declare Function FindWindowEx Lib "user32" 
>     Alias "FindWindowExA" (ByVal hWnd1 As Long, 
>                            ByVal hWnd2 As Long, 
>                            ByVal lpsz1 As String, 
>                            ByVal lpsz2 As String) As Long

public static native long findWindowEx(long hWnd1, long hWnd2, String
lpsz1, String lpsz2);

> Public Declare Function SendMessageByString Lib "user32" 
>     Alias "SendMessageA" (ByVal hWnd As Long, 
>                           ByVal wMsg As Long, 
>                           ByVal wParam As Long, 
>                           ByVal lParam As String) As Long

public static native long sendMessageByString(long hWnd, long wMsg,
long wParams, String lParam);

Running javah on the class and writing the C calls to user32.dll is
left as an exercise to the reader.




==========================================================================
TOPIC: Tomcat + Eclipse setup
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/217b0f0d4770b747
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 1:08 am
From: [EMAIL PROTECTED] (Horst Walter) 

I have a brief question about my Tomcat config. I try to place the
webapps folder structure inside my Eclipse project strutcure, but
outside the Tomcat home directory. Example:

c:\Eclipse\MyProject
c:\Java\Tomcat\webapps

In order to do so I set in the server XML:

<Host name="localhost" debug="0" 
appBase="c:\Eclipse\MyProject" unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

mywebapp.xml:
<Context path="/mywebapp" docBase="c:\Eclipse\MyProject\mywebapp">

Question: I would expect mywebapp.war to be automatically unpacked
when I place it in c:\Eclipse\MyProject (it's the appbase). That's the
way it works when I leave the webapp dir unchanged (inside tomcat
home). However, it does not work when I set the dir outside the tomcat
home dir.

Any hints would be appreciated.
Regards HW

PS: Tomcat 5.0.25 on Win2k




==========================================================================
TOPIC: 1.5 howto
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f65789ac1abef909
==========================================================================

== 1 of 4 ==
Date:   Tues,   Aug 31 2004 1:19 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

Jacob wrote:

>     int compareTo (Object o)
>
> doesn't compile in 1.5. What is the fix, and is it possible
> to fix so it works under both 1.4 and 1.5?

On the face of it, this sounds implausible.  I think this is one of the cases
where we can reasonably ask for a short, but compilable (with one or the other
compiler ;-), complete example.

    -- chris






== 2 of 4 ==
Date:   Tues,   Aug 31 2004 1:22 am
From: [EMAIL PROTECTED] (Jesper Nordenberg) 

Jacob <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Is it wise to start looking at 1.5 for large scale commercial
> development, or should I wait? How long?

Until Java 5 final is released?

> Can I create code to compile with both 1.4 and 1.5? (Currently
> I get problems with 1.4 code that appears to need generics updates,
> but then I loose the possibility to compile with 1.4? I don't need
> 1.5 features as such; I just want to push existing 1.4 code through.)

I believe you only get warnings, right? There shouldn't be any
compiler errors when compiling old source code with 1.5.

> Can I run 1.5 compiled code with 1.4 tools?

Yes, but you must first run the class files compiled with 1.5 through
this tool:

http://retroweaver.sourceforge.net/

Not all 1.5 features are supported, but most are.

> Can I run 1.4 compiled code with 1.5 tools?

Yes, that shouldn't be any problem.

> Is jikes ready for 1.5? Should I use it?

Don't know.

/Jesper Nordenberg



== 3 of 4 ==
Date:   Tues,   Aug 31 2004 1:58 am
From: Jacob <[EMAIL PROTECTED]> 

Chris Uppal wrote:
> Jacob wrote:
> 
> 
>>    int compareTo (Object o)
>>
>>doesn't compile in 1.5. What is the fix, and is it possible
>>to fix so it works under both 1.4 and 1.5?
> 
> 
> On the face of it, this sounds implausible.  I think this is one of the cases
> where we can reasonably ask for a short, but compilable (with one or the other
> compiler ;-), complete example.


If I extend a class that implements Comparable
and I override compareTo, I'd do like this in 1.4:


   public class Test extends java.util.Date
     implements Comparable // ?
   {
     public int compareTo (Object o) {return 0;}
   }


I am not quite sure if the new class should explicitly
state "implements Comparable". This seems to be optional
in 1.4, but I get different error messages from 1.5:

a) "implements Comparable" included:

   Test.java:5: java.lang.Comparable cannot be inherited with
                different arguments: <> and <java.util.Date>

b) "implements Comparable" not included:

   Test.java:5: name clash: compareTo (java.lang.Object) in Test
                and compareTo(T) in java.lang.Comparable<java.util.Date>
                have the same erasure, yet neither overrides the other

With focus on the original question: Is there a way I can
modify my 1.4 solution so that it also compiles under 1.5
(both of the above are _errors_)?




== 4 of 4 ==
Date:   Tues,   Aug 31 2004 3:22 am
From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> 

Jacob <[EMAIL PROTECTED]> writes:

>    Test.java:5: java.lang.Comparable cannot be inherited with
>                 different arguments: <> and <java.util.Date>

This is because 1.5's Collections API uses parametrized types: You need

implements Comparable<Date>

and

public int compareTo(<? extends Date> o) {
}




==========================================================================
TOPIC: Different compilers = Different byte code?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d6730b906587dde
==========================================================================

== 1 of 3 ==
Date:   Tues,   Aug 31 2004 1:19 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:

> Nothing strange about it. The Java class file format was changed a few
> times, and some of the changes lead to incompatibilities with older JVMs.

Not that the format actually /did/ change -- just the version numbers.  E.g. a
class file produced with target = 1.4, would run perfectly well on a 1.1 JVM if
the version numbers hadn't changed.  I think Sun screwed up and confused the
library with the JVM.

    -- chris






== 2 of 3 ==
Date:   Tues,   Aug 31 2004 1:43 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Chris Uppal wrote:
>>Nothing strange about it. The Java class file format was changed a few
>>times, and some of the changes lead to incompatibilities with older JVMs.
> 
> 
> Not that the format actually /did/ change -- just the version numbers.

Are you sure that the introduction of assertions did not require a
true incompatibility?



== 3 of 3 ==
Date:   Tues,   Aug 31 2004 3:34 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:

> > Not that the [class file] format actually /did/ change -- just the version
numbers.
>
> Are you sure that the introduction of assertions did not require a
> true incompatibility?

Hmm, good point.  I had completely forgotten about assertions -- I never use
them and have never really thought much about them.

<pause, checks... />

I think it's more what I'd call a library issue: the assertions are compiled
into normal bytecodes in normal classfile format.  For instance, code like:

    private static void
    method1(int i)
    {
        assert i > 0;
    }

is compiled into:

    private static method1 (I)V
        getstatic Test/$assertionsDisabled Z
        ifne 9
        iload_0
        ifgt 9
        new java/lang/AssertionError
        dup
        invokespecial java/lang/AssertionError/<init> ()V
        athrow
    9: return

I.e, for those who don't like reading bytecodes (and who does ?):

        private static void
        method1(int i)
        {
                if (!$assertionsDisabled && i <= 0)
                        throw new AssertionError();
        }

And there is code in the class's <cinit> that does the equivalent of:

    static
    {
        $assertionsDisabled = !Test.class.desiredAssertionStatus();
    }

to initialise the synthetic static field:

    static final boolean $assertionsDisabled;

None of the bytecodes are in any way (that I can see) abnormal, and do not
require any co-operation from the JVM to execute properly (turning assertions
/on/ would require co-operation, but that's not a issue for the format of the
class file).

Of course, it's clear that these code snippets wouldn't work against a class
library where java.lang.Class didn't have a desiredAssertionStatus() method, or
where class java.lang.AssertionError didn't exist, so you can't actually /use/
classfiles with assertions in a (vanilla) 1.2 JVM (say).  And that is certainly
the practical point that will interest most people -- no question.  However,
I'd still call it a library issue, not a problem caused by the classfile format
as such (or by changes to the JVM spec).  Indeed, classfiles with assertions
would load perfectly well into an earlier JVM (ignoring the "version" number),
and fail in a perfectly well-defined way as part of the /normal/ correct
operation of valid classfiles that happen refer to non-existent classes, or to
non-existent members of classes.

Admittedly, that's all more interesting than actually very useful ;-)  Still,
at least I now know what assertions "really mean".

    -- chris






==========================================================================
TOPIC: How to wait for multiple threads to finish
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d0cf1fcbe3125cb5
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 1:19 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

thoff wrote:

> > (In any case, I'm not convinced that the Erlang way of programming with
> > micro-threads would work so well without Erlang's "share nothing"
> > semantics, or something similar.)
>
> That's why it's a program language issue. With a share nothing
> model and a global heap for efficient message sends, mere mortals can
> make concurrent programs work. Not something you can say about java.

Fair point, I think.

    -- chris







==========================================================================
TOPIC: Would like a preprocessor.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8d589c27ece424e
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 1:20 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

Glen wrote:

> Well actually I want to distritbute the finished product without forcing
> the user to use a certain JVM like hotspot.  So it is possible that
> someone might use a much older JVM that isnt as smart.  Also I want to
> target machines with different processors and operating systems.

I agree (though I hadn't thought of the possibility that you might be
targeting J2ME, as someone mentioned -- where I believe well-optimised
bytecode /is/ the way to get speed).  I was just thinking that experimenting
with different optimisers might give you a sense of the amount of 'slack'
available to be removed by tighter coding.

> I'd be happy to post the inlined vs. non-inlined version in the future.

I'd be pleased to see it.  But just the numbers, please, unless the code is
short and readable (which -- by definition -- it won't be ;-)


BTW, I mentioned bytecode optimisers.  The 'Soot' project from Sable claims to
do both class-level and whole-program optimisation.  The Soot is available, I
think, somewhere under <www.sable.mcgill.ca/>, but that server seems to be down
just now (it was OK yesterday).  The only other optimiser that I know of
(though I do know that there are others) is JavaGO by Konstantin Knizhnik,
which is at <http://www.garret.ru/~knizhnik/javago/ReadMe.htm>.  Both are
fairly old, and there is a chance that they might be confused by the new way
that javac compiles "finally" blocks (though soot is part of a framework that
/ought/ to be able to handle /any/ legal bytecode), in which case it might pay
you to use an earlier version of javac -- if you choose to evaluate optimisers
at all.

    -- chris







==========================================================================
TOPIC: mpeg iframes in JAI
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fa40eaf6b61d9982
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 1:48 am
From: "Adam" <[EMAIL PROTECTED]> 

Does anyone know if Java Advanced Imaging can decode an MPEG iFrame?

Adam






==========================================================================
TOPIC: comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2002-12-28)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1dfbde0ee0a3558e
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 2:25 am
From: [EMAIL PROTECTED] (David Alex Lamb) 

Last-Modified: Sat Dec 28 12:08:40 2002 by David Alex Lamb
Archive-name: computer-lang/java/help/minifaq
Posting-Frequency: every 4 days

Before posting read Jon Skeet's "How to get answers on the comp.lang.java.*
newsgroups" at http://www.pobox.com/~skeet/java/newsgroups.html

Java FAQs and advice:
- Java/Javascript/Powerbuilder HOWTO (Real Gagnon)
  http://www.rgagnon.com/howto.html
- Java Glossary (Roedy Green)  http://www.mindprod.com/jgloss.html
- Java Programmers' FAQ (Peter van der Linden) http://www.afu.com/javafaq.html
- jGuru jFAQs (John Zukowski)    http://www.jguru.com/jguru/faq/
- Focus on Java (John Zukowski)   http://java.about.com/
- Java Q&A (David Reilly)  http://www.davidreilly.com/jcb/faq/

comp.lang.java.help     Set-up problems, catch-all first aid.
    According to its charter, this unmoderated group is for immediate help
    on any Java problem, especially when the source of the difficulty is
    hard to pin down in terms of topics treated on other groups.
        This is the appropriate group for end-users, programmers and
    administrators who are having difficulty installing a system capable of
    running Java applets or programs.  It is also the right group for
    people trying to check their understanding of something in the
    language, or to troubleshoot something simple.

comp.lang.java.programmer  Programming in the Java language.
    An unmoderated group for discussion of Java as a programming language.
    Specific example topics may include:
      o types, classes, interfaces, and other language concepts
      o the syntax and grammar of Java
      o threaded programming in Java - sychronisation, monitors, etc.
      o possible language extensions (as opposed to API extensions).
    The original charter said that discussion explicitly should not include
    API features that are not built into the Java language and gave examples
    like networking and the AWT.  These days AWT belongs in clj.gui, and
    networking is often discussed in clj.programmer.

Do not post binary classfiles or long source listings on any of these
groups. Instead, the post should reference a WWW or FTP site (short source
snippets to demonstrate a particular point or problem are fine).

Don't post on topics that have their own groups, such as:
 comp.lang.java.3d        The Java 3D API
 comp.lang.java.advocacy  Arguments about X versus Y, for various Java X and Y
 comp.lang.java.beans     JavaBeans and similar component frameworks
 comp.lang.java.corba     Common Object Request Broker Architecture and Java
 comp.lang.java.databases Using databases from Java
 comp.lang.java.gui       Java graphical user interface design and construction
 comp.lang.java.machine   Java virtual machines, like JVM and KVM
 comp.lang.java.security  Using Java securely
 comp.lang.java.softwaretools Tools for developing/maintaining Java programs
Don't cross-post between these groups and c.l.j.programmer or .help -- it just
wastes the time of people reading the general groups.

Don't post about JavaScript; it's a different language.  See
comp.lang.javascript instead.
-- 
"Yo' ideas need to be thinked befo' they are say'd" - Ian Lamb, age 3.5
http://www.cs.queensu.ca/~dalamb/   qucis->cs to reply (it's a long story...)




==========================================================================
TOPIC: java.lang.Set with elements of type java.lang.Set
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/81df6c6e14ce73d2
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 3:40 am
From: [EMAIL PROTECTED] (Harald Kirsch) 

Eric Sosman <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Harald Kirsch wrote:
> > Roughly I do something along the lines of:
> > 
> >   Set set = new HashSet();
> >   Set elem = new HashSet();
> >   set.add(elem);
> > 
> >   // now we change the elem and add it again to the set
> >   elem.add(some object here);
> >   set.add(elem);
> > [...]
> > Comments?
> 
>      In addition to what others have mentioned, let me
> draw your attention to this warning from the Javadoc
> for the Set interface:
> 
>       "Note: Great care must be exercised if mutable
>       objects are used as set elements. The behavior
>       of a set is not specified if the value of an
>       object is changed in a manner that affects equals
>       comparisons while the object is an element in the
>       set. [...]"

Thanks for pointing this out. In a way I was looking for
such a comment, because it seems to be inevitable. I guess
I missed it in the Set docs since I thought it would 
be a problem of the implementation. Thinking about it,
I realize that an implementation which does not have 
this "problem" would be very slow, being forced to
probe all its elements on insertions and deletions.

  Harald.




==========================================================================
TOPIC: Waiting for the end of multiple threads
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ea50a92c1a9cd2a
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 3:56 am
From: [EMAIL PROTECTED] (Andrea B.) 

In my java application i need to launch several parallel threads to
execute elementary parts of a complex calculation.
 
So, the main application should wait for the end of all the threads
and evaluate a general result.
 
I also have to notify to the main application when some thread exceed
a maximum timeout.
 
Could someone tell me how to implement this programming logic in Java?
 
I would be grateful if you could send me some sample code.
 
Thanks in advance




==========================================================================
TOPIC: Thread synchronization problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51dbef92f81ca351
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 4:03 am
From: [EMAIL PROTECTED] (Vincent Lascaux) 

Hello,

I have a class that store informations and has an "empty" attribute.
Whenever I want to access this information, I first check if the class
is "empty". If so, I download the information and set the class non
empty. So I have this method:

private synchronized void assertNotEmpty()
{
  if(isEmpty())
  {
    download();
    //now isEmpty() is false
  }
}

The problem is that I now require download to be multi-threaded, and
to access some of the methods of the class (it even access the
assertNotEmpty method since it is reading some informations from the
object after having started the download). This obviously result in a
deadlock.

The simple solution is to remove the synchronized, but then I may (and
this happens because "download" is rather long) download several time
the informations (and I dont want that).

How to solve this kind of problem?

Thank you

-- 
Vincent



=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/prefs

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to