Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Jan Osykowski

Ranch Hand
+ Follow
since Jul 15, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jan Osykowski

Hi,

I'm pretty new with GWT but I have read on already quiet a lot and tested as well. In general GWT translated the Java code that we write into Javascript. That's straightforward. But in the sample application, I have a file war\MyCoolApp.html in which there is an html structure:

which further is used in Java code to place the elements:
(from src\com\oi\gwtex\client\MyCoolApp.java)

RootPanel.get("nameFieldContainer").add(nameField);
RootPanel.get("sendButtonContainer").add(sendButton);
RootPanel.get("errorLabelContainer").add(errorLabel);


And now is my questions how these two things mix? At the beginning I thought that the main html page will not contain anything in the body and everything will be done by the script that is loaded before everything else. But now it seems that the script is loaded and further the html structure is rendered on it's own as well. Can someone explain me this in more details please?

Cheers,
Jan.
11 years ago
GWT
Hi,

So as I read in the refered topic, the information about the parameterized generic type is not actually erased but it is still saved in the .class file and that's why a reflection can access it?

What doubt do you have about these examples? If you add a new topic in a different subforum please let me know.

Cheers,
Jan.
Thanks for the answer. So does it mean that if I use a reflection (I import some field from reflection package) then the compiler doesn't remove the information about the used parameters in the generic types?

Cheers,
Jan.
Hey,

In the K&B SCJP book I have read that generic types are only for the compilation type. After it, they are removed and they look like old non generic classes. Here I paste 2 codes for which I would like any of you to explain me (please!!!) how it happens that I can actually get the generic type during the run time.

In the first code, we extend the generic class and then through the subclass we are able to get the generic type of the superclass:



The output is:

class P1
class java.lang.String
class P3



The second code does the same but without extending:



And the output is:


class P1
class java.lang.Integer
class P3



Can anyone help me with understanding this 2 codes?

Cheers,
Jan.
Hey guys,

Let's have a look at this piece of code:



And this code prints:

Parent get1 Child get2


The second part is clear, it's just regular overriding. But as for the part 1 "Parent get1". A static method is chosen based on the reference type during compilation time. So in the main method we are creating an instance of a Child class which has inherited get() method. Then it runs get() but still using the Child instance. So I think that the method get1() from the Child class should be chosen but it's not. The one from Parent is chosen even though we use the Child class instance.
Could someone explain me what's going on?

Cheers,
Jan.
Hey,

I got a question about this code:


it splits on "aaa" but it return 4 in fact. And I can't see how. Can someone explain me?

Cheeers,
Jan.
Ok guys, thanks for the answers! This is the case that got away from me!
Hey guys,

My question is in the subject, when it will not be reached? I remember that I read in the book that there is such a case but now I can't find this part when it happenss.

Cheers,
Jan.
Alright! Thanks. Now it's all clear!
Yes but I'm refering to my first post where I have a question about the == operator which is used on an object and primitive and returns true. I still don't get why...
but this code:



return false. So I think it's not true that any two Booleans will return true with ==.
Thanks you for the answer and a great example! Yeah, that's straightforward now. A class can implement any interface so instanceof operator can not reject it !
Hey,

I have read that instanceof operator can not be used on the instances/classes that belong to different inheritance tree and that it will result in compile error. But now I have come across this example:

And as I look in the book HashMap and Collection are in completly different inheritance tree but the above code still works. Can anyone explain why?

Cheers,
Jan.
Hey guys,

I have a question about situation like this:


I thought that here the == comparison will return false because == operator looks at the references and b3 is a primitive and b2 is an Object. But for some reason, the b2 got unboxed and the comparison resulted in the true value. Can anyone tell me if this can happen with some other types in Java? Or about some similar situations that may occur?

Cheers,
Jan.