{BUG} Core.xml

Vader

Well-Known Member
Licensed User
Longtime User
Core.xml has the following entries in String2:

charAt
compareTo
contains
endsWith
equalsIgnoreCase
getBytes
indexOf
indexOf
lastIndexOf
lastIndexOf
length
replace
startsWith
substring
substring
toLowerCase
toUpperCase
trim

As you can see, the following are duplicated:
indexOf
lastIndexOf
substring

I can't think of any reason you would want these to be listed multiple times.

EDIT: The signatures are different, but everywhere else, we would see something like:
indexOf2
lastIndexOf2
substring2
 
Last edited:

Vader

Well-Known Member
Licensed User
Longtime User
In my old lashed-up xml reader B4AHelp.exe they look as expected e.g LastIndexOf and LastIndexOf2 etc. I can't find any duplication when I open core.xml in Notepad++ either. :confused:

Ok, so found them in Core.xml...

<name DesignerName="SubString2">substring</name>
<name DesignerName="IndexOf2">indexOf</name>
<name DesignerName="LastIndexOf2">lastIndexOf</name>

So that means two things...

1. B4a Object Browser has a <cough> bug, but only a small one.
Technically it is showing the correct information, but it is not correctly reading or taking into account the "DesignerName" Attribute of the "Name" Element.

2. B4a CAN actually have multiple keywords with the same name, but not the same DesignerName.

Not that it helps in this discussion. I guess I have to pause my documentation efforts and fix this bug. :(

Thanks for the clues though.

EDIT2:

Erel, is it only Methods that can have a DisplayName, or do I have to also look at Properties and Fields?

EDIT3:
Assuming it is only Methods, I have fixed the B4a Object Browser, but I can't release it until I have fully tested it to ensure all functions work as expected (Search etc), plus I will wait for Erel to get back to me.
 
Last edited:

Vader

Well-Known Member
Licensed User
Longtime User
DesignerName is used to capitalise the Methods as you would expect.

For example, startsWith has a DesignerName of StartsWith, and as I now show the DesignerName instead of the Name (if it is defined), then things start to look rather differently.

Very interesting...
 

agraham

Expert
Licensed User
Longtime User
Erel, is it only Methods that can have a DisplayName, or do I have to also look at Properties and Fields?
I dug out the source of B4AHelp which was a hack that grew like Topsy to keep up with the development of Basic4android when I was testing for Erel during development.

I believe that the name tag can only have two forms
B4X:
<name DesignerName="SubString2">substring</name>

<name>RemoveView</name>
My old code simply checked for the DesignerName attribute and used that value if it was present.

In practice I think DesignerName is only used for String because String is treated specially in the Basic4android compiler and unlike, for example Views, is not a discrete class in Core.jar. The actual class in Core.jar is an abstract class called String2 with the methods decorated by an @DesignerName attribute. The actual mechanism for the use, if any, of this abstract class is known only to Erel :)
 

Vader

Well-Known Member
Licensed User
Longtime User
String2 is a special case. It is required in order to allow code such as:
B4X:
x = "abc".Length

DesignerName attribute is used in other cases as well. The IDE will show it if it is available. For example it allows you to compile libraries in obfuscate mode.

Thanks Erel.
 
Top