B4J Question Classname

Daestrum

Expert
Licensed User
Longtime User
If I create a standard class module in a project and then try to access it from inline java, the class name has become all lowercase.

A class module named Person should produce a class named 'Person', but actually creates one called 'person'. (the same is true of type definitions, they produce lowercase class names too)

If there is a good reason for it I can work around it and please ignore this post, but it does go against Java naming conventions for classes.
 

alwaysbusy

Expert
Licensed User
Longtime User
I think this is by design. Java is case sensitive but B4X, in tradition of VB, is not. This makes in one thing less to think of for us, the programmers. Example in this case where both statements will work because of the lowercasing, while if the case was preserved, it would mean calling two different methods:

B4X:
CallSub(main, "myMethod")
CallSub(main, "MyMethod")

I use the same 'trick' in my ABM library where for example the ID of a html tag is also case sensitive, but in B4X it doesn't matter if you use:

B4X:
Dim label as ABMLabel = ABM.GetComponent("myID")
Dim label as ABMLabel = ABM.GetComponent("myid")
 
Upvote 0
Top