4 ms·
Think about it, does it really? To parse Foo x = new Foo();, javac has to perform type inference on the right hand side to figure out its type, and then check
by desdiv 12y ago
Think about it, does it really?
To parse Foo x = new Foo();, javac has to perform type inference on the right hand side to figure out its type, and then check whether that type is a subtype of the left hand side. Telling the compiler: "hey, trust me, variable x is of type Foo" doesn't make the compiler's job any easier at all.
- one-more-minute 12y agoIn that case specifically, no, but in general doing type inference means running a constraint solver over the entire program, which will definitely add some overhead to the compilation time.
- avita1 12y agoYup, the best example I know of is resolving implicit scopes in Scala.