[fpc-devel] JVM: Question regarding converted Java code

Sven Barth pascaldragon at googlemail.com
Fri Dec 30 15:37:08 CET 2011


On 30.12.2011 15:25, Jonas Maebe wrote:
>
> On 29 Dec 2011, at 14:18, Sven Barth wrote:
>
>> On 29.12.2011 13:49, Jonas Maebe wrote:
>>>
>>> On 28 Dec 2011, at 23:28, Sven Barth wrote:
>>>
>>>> 1) as it seems to be a rather usual practice in Java, would it be possible to disable the "Constructor should be public" warnings if the target cpu is the JVM?
>>>
>>> Yes.
>>
>> This would be nice :)
>
> Actually, it should only be done for external classes. For classes defined in Pascal code, the compiler itself enforces the default FPC/Delphi behaviour whereby constructors from parent classes are automatically inherited (if it would not do that, you would have to manually redeclare every constructor that you wanted to reuse, because you cannot construct a Java class using a constructor defined in a parent class). As a result, every class will have at least one public constructor (a parameterless one), which is the original reason for the warning and the same on all targets.

For me it would be ok if this is for external classes only.

> You can of course always use the -vq/-vm command line parameters to manually disable that warning.

This is of course always a possibility, but this is a case - in my 
opinion - where not the symptom, but the cause the should be healed. ;)

Regards,
Sven



More information about the fpc-devel mailing list