Android Question Compiling error - Can someone explain? Error javac 1.8.0_261

WebbyBoy

Member
Licensed User
Longtime User
Hi,

I've been trying to compile my app, and suddenly it has come up with this error. Can someone explain? Is it my Java that needs updating?

Thanks in advance.

B4A Version: 11.50
Parsing code. (0.18s)
Java Version: 8
Building folders structure. (0.03s)
Compiling code. (0.12s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.12s)
Linking resources (1.51s)
Compiling generated Java code. Error
javac 1.8.0_261
src\simplenotes\tsnicholl\webbyboycouk\main.java:455: error: boolean cannot be dereferenced
vis = vis | (vis.mostCurrent != null);
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
 

drgottjr

Expert
Licensed User
Longtime User
assuming vis is a boolean, vis.mostCurrent doesn't work as you are dereferencing vis (which can only be true or false). by the way, a boolean can't be null; it can only be true or false (the default). a Boolean is a different story; it can be null.
updating java 1.8 can involve a different licensing agreement with oracle. i forget where they drew the line. in this case, howerver, the error is not related.
 
Upvote 0

WebbyBoy

Member
Licensed User
Longtime User
Looks like you have managed to make an invalid statement in B4A that compiles to bad Java, escaping any B4A checks. Would be interesting to see that line of B4A code to see how you have done that!
The thing is, this error is from the main.java file as it is being compiled & not the main.bas. Line 455 in the code is blank. Here are the details from the main.java file.

public static boolean isAnyActivityVisible() {
boolean vis = false;
vis = vis | (main.mostCurrent != null);
vis = vis | (information.mostCurrent != null);
vis = vis | (settingsmenu.mostCurrent != null);
vis = vis | (exportdb.mostCurrent != null);
vis = vis | (importdb.mostCurrent != null);
vis = vis | (speechtotext.mostCurrent != null);
vis = vis | (vis.mostCurrent != null);
return vis;}
 
Upvote 0

WebbyBoy

Member
Licensed User
Longtime User
Post the code for your Sub isAnyActivityVisible which is where the error is.
I don't have a Sub called isAnyActivityVisible, this is created in the main.java file at compilation.

I think I have sussed the issue as I had previously created a module called vis, which I then removed. On compiling the app, the below code is added to the main.java file. In here is a boolean also called vis, which I think confused the compiler into thinking I was referencing that field instead of a module.

public static boolean isAnyActivityVisible() {
boolean vis = false;
vis = vis | (main.mostCurrent != null);
vis = vis | (information.mostCurrent != null);
vis = vis | (settingsmenu.mostCurrent != null);
vis = vis | (exportdb.mostCurrent != null);
vis = vis | (importdb.mostCurrent != null);
vis = vis | (speechtotext.mostCurrent != null);
vis = vis | (vis.mostCurrent != null);
return vis;}

I had to restore one of the earlier autosaves to get things back to normal, but we're there.

Cheers.
 
Upvote 0
Top