You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Latest version of spec, section 10.10.1 replaces errors with warnings in cases where the class or the constructor is undeclared. Motivation is similar to other cases: do not impose workflow - just warn and make it a dynamic error.
"Let e be a new expression of the form new T.id(a1, .., an, xn+1: an+1, …, xn+k: an+k) or the form new T(a1, .., an, xn+1: an+1, …, xn+k: an+k). It is a static warning if T is not a class or interface accessible in the current scope, optionally followed by type arguments.
If e is of the form new T.id(a1, .., an, xn+1: an+1, …, xn+k: an+k) it is a static warning if T.id is not the name of a constructor declared by the type T. If e of the form new T(a1, .., an, xn+1: an+1, …, xn+k: an+k) it is a static warning if the type T does not declare a constructor with the same name as the declaration of T.
"
Consequently, it is a dynamic error to call such an undefined constructor:
"Evaluation of e proceeds as follows:
If T is not a class or interface accessible in the current scope, a dynamic error occurs. Otherwise, if q is not defined, a NoSuchMethodError is thrown. Otherwise, if q is a generative constructor (regardless of whether q is redirecting or not), then: ..."
The text was updated successfully, but these errors were encountered:
See issue #1031.
Latest version of spec, section 10.10.1 replaces errors with warnings in cases where the class or the constructor is undeclared. Motivation is similar to other cases: do not impose workflow - just warn and make it a dynamic error.
"Let e be a new expression of the form new T.id(a1, .., an, xn+1: an+1, …, xn+k: an+k) or the form new T(a1, .., an, xn+1: an+1, …, xn+k: an+k). It is a static warning if T is not a class or interface accessible in the current scope, optionally followed by type arguments.
If e is of the form new T.id(a1, .., an, xn+1: an+1, …, xn+k: an+k) it is a static warning if T.id is not the name of a constructor declared by the type T. If e of the form new T(a1, .., an, xn+1: an+1, …, xn+k: an+k) it is a static warning if the type T does not declare a constructor with the same name as the declaration of T.
"
Consequently, it is a dynamic error to call such an undefined constructor:
"Evaluation of e proceeds as follows:
If T is not a class or interface accessible in the current scope, a dynamic error occurs. Otherwise, if q is not defined, a NoSuchMethodError is thrown. Otherwise, if q is a generative constructor (regardless of whether q is redirecting or not), then: ..."
The text was updated successfully, but these errors were encountered: