-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b123
-
generic
-
generic
-
Not verified
From the package specification of javax.lang.model:
"During annotation processing, operating on incomplete or erroneous programs is necessary; however, there are fewer guarantees about the nature of the resulting model. If the source code is not syntactically well-formed, a model may or may not be provided as a quality of implementation issue. If a program is syntactically valid but erroneous in some other fashion, the returned model must have no less information than if all the method bodies in the program were replaced by |"throw new RuntimeException();"|. If a program refers to a missing type XYZ, the returned model must contain no less information than if the declaration of type XYZ were assumed to be |"class XYZ {}"|, |"interface XYZ {}"|, |"enum XYZ {}"|, or |"@interface XYZ {}"|. If a program refers to a missing type |XYZ<K1, ... ,Kn>|, the returned model must contain no less information than if the declaration of XYZ were assumed to be |"class XYZ<T1, ... ,Tn> {}"| or |"interface XYZ<T1, ... ,Tn> {}"
When modeling erroneous types that *cannot* be corrected via annotation processing, it may be better to have the specification say:
" "If the source code is syntactically ill-formed or has some other irrecoverable error that could not be removed by the generated of new types, a model may or may not be provided as a quality of implementation issue." "
This allows an implementation to fail faster on known-bad code without requiring that behavior.
"During annotation processing, operating on incomplete or erroneous programs is necessary; however, there are fewer guarantees about the nature of the resulting model. If the source code is not syntactically well-formed, a model may or may not be provided as a quality of implementation issue. If a program is syntactically valid but erroneous in some other fashion, the returned model must have no less information than if all the method bodies in the program were replaced by |"throw new RuntimeException();"|. If a program refers to a missing type XYZ, the returned model must contain no less information than if the declaration of type XYZ were assumed to be |"class XYZ {}"|, |"interface XYZ {}"|, |"enum XYZ {}"|, or |"@interface XYZ {}"|. If a program refers to a missing type |XYZ<K1, ... ,Kn>|, the returned model must contain no less information than if the declaration of XYZ were assumed to be |"class XYZ<T1, ... ,Tn> {}"| or |"interface XYZ<T1, ... ,Tn> {}"
When modeling erroneous types that *cannot* be corrected via annotation processing, it may be better to have the specification say:
" "If the source code is syntactically ill-formed or has some other irrecoverable error that could not be removed by the generated of new types, a model may or may not be provided as a quality of implementation issue." "
This allows an implementation to fail faster on known-bad code without requiring that behavior.
- relates to
-
JDK-8190054 Provide guidance on handling of erroneous program constructs
-
- Open
-