Java Question lambda expressions are not supported in -source 7

Johan Schoeman

Expert
Licensed User
Longtime User
How can I by bypass this error in a wrapper?

B4X:
lambda expressions are not supported in -source 7
        runOnUiThread(() -> {
                         ^
  (use -source 8 or higher to enable lambda expressions)
1 error

javac 11.0.1

Error.

This is the code that errors:
B4X:
    private void showHintDialog() {
        runOnUiThread(() -> {

        });
    }
 

Johan Schoeman

Expert
Licensed User
Longtime User
I can bypass the lambdas. Now I get package android.os.Bundle does not exist when I am pointing to Android 28 or 30. The class is clearly included in android 28 and 30. Also some other android.os.xxx classes that does not exist although clearly present in the android 28 and 30 jars...? Mind boggling...
 

Johan Schoeman

Expert
Licensed User
Longtime User
Are you compiling with SLC? Make sure to use the B4A version and not the B4J.
Compiling it with SLC @Erel - definitely not using the B4J SLC but version 1.11 for Android . This is the message:

B4X:
Completed successfully.
Starting step: Creating jar file.
Completed successfully.
Starting step: Creating XML file.
javadoc: warning - The old Doclet and Taglet APIs in the packages
com.sun.javadoc, com.sun.tools.doclets and their implementations
are planned to be removed in a future JDK release. These
components have been superseded by the new APIs in jdk.javadoc.doclet.
Users are strongly recommended to migrate to the new APIs.
C:\Users\johans\Documents\Basic4Android\b4aProjects\JamesNFC\Nfcregtest\app\src\com\reginald\nfcregtest\CheckCardCallbackV2Wrapper.java:3: error: package android.os does not exist
import android.os.Bundle;
                 ^
C:\Users\johans\Documents\Basic4Android\b4aProjects\JamesNFC\Nfcregtest\app\src\com\reginald\nfcregtest\CheckCardCallbackV2Wrapper.java:4: error: package android.os does not exist
import android.os.RemoteException;
                 ^
C:\Users\johans\Documents\Basic4Android\b4aProjects\JamesNFC\Nfcregtest\app\src\com\reginald\nfcregtest\CheckCardCallbackV2Wrapper.java:5: error: package android.util does not exist
import android.util.Log;
                   ^
C:\Users\johans\Documents\Basic4Android\b4aProjects\JamesNFC\Nfcregtest\app\src\com\reginald\nfcregtest\CheckCardCallbackV2Wrapper.java:10: error: cannot access IInterface
public class CheckCardCallbackV2Wrapper extends CheckCardCallbackV2.Stub {
       ^
  class file for android.os.IInterface not found
java.lang.NullPointerException
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$MembersPhase.runPhase(TypeEnter.java:934)
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:282)
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$MembersPhase.doCompleteEnvs(TypeEnter.java:877)
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:251)
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:266)
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:266)
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:266)
    at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:198)
    at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
    at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1326)
    at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:583)
    at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:560)
    at jdk.javadoc/com.sun.tools.javadoc.main.JavadocEnter.main(JavadocEnter.java:81)
    at jdk.javadoc/com.sun.tools.javadoc.main.JavadocTool.getRootDocImpl(JavadocTool.java:222)
    at jdk.javadoc/com.sun.tools.javadoc.main.Start.parseAndExecute(Start.java:426)
    at jdk.javadoc/com.sun.tools.javadoc.main.Start.begin(Start.java:238)
    at jdk.javadoc/com.sun.tools.javadoc.main.Start.begin(Start.java:224)
    at jdk.javadoc/com.sun.tools.javadoc.Main.execute(Main.java:174)
    at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:419)
    at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:344)
    at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
    at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
javadoc: error - fatal exception

Error.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Are you using Java 8, though this may be a red herring in this case? BADoclet doesn't like Java 11 and produces bad xmls. Erel may fix it some time in the future but he has not given a timescale for it.
Using Java 11 @agraham - will try on my old laptop as it has Java 8
 

Johan Schoeman

Expert
Licensed User
Longtime User
Are you using Java 8, though this may be a red herring in this case? BADoclet doesn't like Java 11 and produces bad xmls. Erel may fix it some time in the future but he has not given a timescale for it.
Compiling with Java 8.?
 
Top