[fpc-devel] JVM: Question regarding converted Java code
jonas.maebe at elis.ugent.be
Fri Dec 30 15:25:34 CET 2011
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?
> 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.
You can of course always use the -vq/-vm command line parameters to manually disable that warning.
More information about the fpc-devel