Hi there this is determined. 2
And welcome back. 3
Now let's look at fuel important restrictions that we have it genetics. 4
We did it is because few of the restrictions earlier this one was one of them pipe argument cannot be 5
primitive. 6
And in this example type argument it would give us a compiler We also very well know this restriction 7
a class level by parameter cannot be used in this context. 8
For instance it cannot be used as a type for static variables. 9
Similarly it cannot be used in static methods as static initializers and we know that if it were static 10
method needed genetic mess then we can define the genetic static method which defines its own parameters 11
. 12
We also know this we got overload methods that will have the same signature after type in nature. 13
He had these two methods would have the same signature after type behavior and hence it is an invalid 14
overload. 15
And this is a new one. 16
Genetics on Arrius do not mix. 17
For instance you cannot create an idea or permit race type. 18
Similarly you cannot also create an army off a type barometer. 19
Both of these a generally are a creation error at compile time. 20
And the reason why we cannot create a generic array is because it does not types. 21
Let's look at an example. 22
For the purpose of this discussion let's assume that genetic areas can be created. 23
Let's consider the statement here the reference type is an array of object NBA creating an art offering 24
Behrami Christ type or a list of string not set in big zero. 25
We are storing and our eldest offspring nextstep in next one we want to store and idlest off India. 26
And this will be possible as a reference type of the object reference. 27
Here is an idea of object and we know that anything can be assigned to an object. 28
So at compile time there will not be an error and we would expect that at runtime we would get an idea 29
stored exception for going to store an element of wrong type in the art. 30
We know that arrays and short typesafe be at runtime. 31
Unfortunately that will not happen here. 32
As we know that there is Pypard engine that is all of the pipe arguments here get airiest and we only 33
have plain aerialist instances in the bytecode. 34
So both elements are simple are illest instances and there is no distinction between them. 35
So John under-prepared does not throw out a strong exception and with that type safety is broken not 36
terminology wise. 37
I would like to bring up a system called refired arrays are set to be refire. 38
What it means is a run by him. 39
Or is the type of element that can be stored in the ID. 40
Now if you start it wrong type we know that we would get an artist or exception. 41
So this property of knowing the element type information and forcing it at runtime is what makes Arrius 42
refined. 43
On the other hand generics in Java are nondairy fight as they're enforced by constraints only at compile 44
time type information is airiest off and is not available at runtime. 45
So just wanted to highlight this from a fight as sooner or later he would surely come across it. 46
It is basically retention and enforcing of type information at runtime. 47
This restriction is related to exceptions that cannot have generic exceptions and etiquettes. 48
That is we cannot have generic types that are direct or indirect subtypes of the class Thorburn we know 49
the plural is the root class in the exception class hierarchy. 50
So you cannot have something like this where we are trying to create generic exception class by extending 51
exception class. 52
If this was legal then we may have something like this but we know that after type it ajor that pipe 53
arguments would go away on the catch crosses would be identical and that would be meaningless right 54
. 55
So just go ahead and try creating such an exception class and you can see the compiler error. 56
So those are the important restrictions that we have. 57
But generics we may have missed a few but these are important ones. 58
That's about it. 59
Thank you