mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 03:48:07 +02:00
* check whether methods that implement interface methods are public
or published, because interface methods are always public and hence mapping them to a private/protected method increases the visibility of the underlying method (error on JVM target because the JVM doesn't like that, warning on other platforms) git-svn-id: branches/jvmbackend@19156 -
This commit is contained in:
parent
5332263d46
commit
3b47c40ed2
@ -1434,7 +1434,7 @@ parser_e_jvm_invalid_virtual_constructor_call=03320_E_Calling a virtual construc
|
||||
% \end{description}
|
||||
# Type Checking
|
||||
#
|
||||
# 04106 is the last used one
|
||||
# 04108 is the last used one
|
||||
#
|
||||
% \section{Type checking errors}
|
||||
% This section lists all errors that can occur when type checking is
|
||||
@ -1811,6 +1811,13 @@ type_e_no_managed_assign_generic_typecast=04106_E_The assignment side of an expr
|
||||
% to statically determine that no type-unsafe assignments or operations occur. By assigning a parent class type to a
|
||||
% variable of a child type by typecasting the assignment side to the parent class type, the type safety would no
|
||||
% longer be guaranteed and the generated code would fail verification at run time time.
|
||||
type_w_interface_lower_visibility=04107_W_The interface method "$1" raises the visibility of "$2" to public when accessed via an interface instance
|
||||
type_e_interface_lower_visibility=04108_E_The interface method "$1" has a higher visibility (public) than "$2"
|
||||
% All methods in an interface have always public visibility. That means that if
|
||||
% an interface method is implemented using a (strict) protected or private method,
|
||||
% this method is actually publicly accessible via the interface. On the JVM
|
||||
% target this situation results in an error because the JVM rejects such
|
||||
% attempts to circumvent the visibility rules.
|
||||
%
|
||||
%
|
||||
% \end{description}
|
||||
|
@ -510,6 +510,8 @@ const
|
||||
type_e_invalid_final_assignment=04104;
|
||||
type_e_no_managed_formal_assign_typecast=04105;
|
||||
type_e_no_managed_assign_generic_typecast=04106;
|
||||
type_w_interface_lower_visibility=04107;
|
||||
type_e_interface_lower_visibility=04108;
|
||||
sym_e_id_not_found=05000;
|
||||
sym_f_internal_error_in_symtablestack=05001;
|
||||
sym_e_duplicate_id=05002;
|
||||
@ -914,9 +916,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 62288;
|
||||
MsgTxtSize = 62479;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
26,90,321,107,87,54,111,23,202,63,
|
||||
26,90,321,109,87,54,111,23,202,63,
|
||||
49,20,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -571,6 +571,14 @@ implementation
|
||||
((proc.procoptions*po_comp)=((implprocdef.procoptions+[po_virtualmethod])*po_comp)) and
|
||||
check_msg_str(proc,implprocdef) then
|
||||
begin
|
||||
{ does the interface increase the visibility of the
|
||||
implementing method? }
|
||||
if implprocdef.visibility<proc.visibility then
|
||||
{$ifdef jvm}
|
||||
MessagePos2(implprocdef.fileinfo,type_e_interface_lower_visibility,proc.fullprocname(false),implprocdef.fullprocname(false));
|
||||
{$else}
|
||||
MessagePos2(implprocdef.fileinfo,type_w_interface_lower_visibility,proc.fullprocname(false),implprocdef.fullprocname(false));
|
||||
{$endif}
|
||||
result:=implprocdef;
|
||||
exit;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user