So for getters and setters a Jit can inline the function call and in the end you have a direct memory access.
In your example you have to cast because URLConnection could be a HttpURLConnection or JarURLConnection.
But again a good Jit would speculate that it is always a HttpURLConnection and deoptimize if not.
imtringued|6 years ago