Hi NetRexxers,
I have to confirm Import-Problems similar to Dion Gillard's. Here is a little sample: -- Start import java.text.DateFormat class RexxImportTest uses DateFormat properties inheritable loc = Locale('DE','DE') /*KurzFormat =java.text.DateFormat.getDateTimeInstance(- java.text.DateFormat.DEFAULT,java.text.DateFormat.SHORT,loc) */ KurzFormat =getDateTimeInstance(DEFAULT,SHORT,loc) should_be_long=long 1000000000000 method RexxImportTest() DateString = KurzFormat.format(Date(should_be_long)) say DateString -- End This compiles the following way: [D:\suco]set classpath CLASSPATH=.;\Java11\lib\classes.zip;\Java11\lib\NetRexxC.zip [D:\suco]nrc RexxImportTest NetRexx portable processor, version 1.125 Copyright (c) IBM Corporation, 1998. All rights reserved. Program RexxImportTest.nrx === class RexxImportTest === constructor RexxImportTest() 14 +++ DateString = KurzFormat.format(Date(should_be_long)) +++ ^^^^ +++ Warning: The constructor 'Date(String)' has been deprecated overrides Object() Compilation of 'RexxImportTest.nrx' successful [one warning] In this case the Warning hides a real error, since the var 'should_be_long' should be of type LONG and not of type REXX. (as the *.crossref says). If I use explicit (FQN java.text.DateFormat.SHORT etc, as in the comment line) naming, then the program compiles and runs as wanted ('should_be_long' finally becomes long). Greetings Kai Schmidt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
Kai Schmidt wrote:
> I have to confirm Import-Problems similar to Dion Gillard's. Here is a little sample: I think your problem is one of name clashes.. > -- Start > import java.text.DateFormat > > class RexxImportTest uses DateFormat Theis makes SHORT, LONG etc available as names to your code. > > properties inheritable > loc = Locale('DE','DE') > /*KurzFormat =java.text.DateFormat.getDateTimeInstance(- > java.text.DateFormat.DEFAULT,java.text.DateFormat.SHORT,loc) */ > KurzFormat =getDateTimeInstance(DEFAULT,SHORT,loc) > should_be_long=long 1000000000000 This variable is actually a Rexx with DateFormat.LONG concatenated with 1000000000 The problem here is that the USES statement overrides the built-in 'long' type in Java, causing your declaration of should be long to actually be a untyped declaration. > method RexxImportTest() > DateString = KurzFormat.format(Date(should_be_long)) > say DateString > > -- End > > This compiles the following way: > > [D:\suco]set classpath > CLASSPATH=.;\Java11\lib\classes.zip;\Java11\lib\NetRexxC.zip > > [D:\suco]nrc RexxImportTest > NetRexx portable processor, version 1.125 > Copyright (c) IBM Corporation, 1998. All rights reserved. > Program RexxImportTest.nrx > === class RexxImportTest === > constructor RexxImportTest() > 14 +++ DateString = KurzFormat.format(Date(should_be_long)) > +++ ^^^^ > +++ Warning: The constructor 'Date(String)' has been deprecated > overrides Object() > Compilation of 'RexxImportTest.nrx' successful [one warning] > > In this case the Warning hides a real error, since the var 'should_be_long' should be of > type LONG and not of type REXX. (as the *.crossref says). etc) now resolves to an int value, and not the built-in java primitive types. > If I use explicit (FQN java.text.DateFormat.SHORT etc, as in the comment line) naming, > then the program compiles and runs as wanted ('should_be_long' finally becomes > long). Yes. Now the real question is should USES and imports be allowed to override primitive types? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
Free forum by Nabble | Edit this page |