Closed srikanth-sankaran closed 1 month ago
@srikanth-sankaran some questions fyi.
Generally, we seem to be converging based on the understanding that no unchecked cast is allowed and hence all type parameters not determined from the super type must be substituted with wildcards, indeed.
Great! Forbidding unchecked casts intuitively make complete sense since control flow may enter the associated block with the wrong type otherwise. Your reference to 14.30.3 and 5.7 elsewhere is bang on as far as the unchecked cast is concerned - thanks.
WRT https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2656 - I seem to have anticipated the introduction of a new context - the testing context - I had named it ExpressionContext.INSTANCEOF_CONTEXT
but on HEAD it is renamed by JEP 455 work to be ExpressionContext.TESTING_CONTEXT
(as it should be)
Generally speaking it hurts that we have poor coverage here. The present implementation of PTB.permittedTypes() uses observed substitutes as being the SAME as the type variables... (my vocabulary may be loose)
@srikanth-sankaran some questions fyi.
Generally, we seem to be converging based on the understanding that no unchecked cast is allowed and hence all type parameters not determined from the super type must be substituted with wildcards, indeed.
To make matters complicated we have a regression in unchecked cast reporting - see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1802 that causes some problems in this area: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1735 I am taking up this now - sorry for deferring the grammar changes study to next week. I am fighting a cluster of issues in switches and sealed types and its helps to stay in context.
What it does
Author checklist