Skip to content

"java.lang.NoSuchFieldException: override" using loadFromJava (JDK 12, Mac) #42

@human-research

Description

@human-research

Hello.
I'm using compiler v 2.3.4.
Here is my code:

    public ILogicalExpression generateFunction(String funcName, String function, String arguments) throws Exception {
        String prepared = prepareExpression(function, arguments);

        String className = funcName + "Expression";

        String source = "import static java.lang.Math.*;\n" +
                "public final class " + className + " implements " + BASE_CLASS_NAME + " {\n"
                + "public boolean compute(double[] args) {\n"
                + "\treturn " + prepared + ";}\n}\n";

        Class aClass = CompilerUtils.CACHED_COMPILER.loadFromJava(className, source);
        ILogicalExpression expr = (ILogicalExpression) aClass.getConstructor().newInstance();

        return expr;
    }
Exception in thread "main" java.lang.AssertionError: java.lang.NoSuchFieldException: override
	at net.openhft.compiler.CompilerUtils.<clinit>(CompilerUtils.java:64)
	at com.synstorm.common.Utils.ConfigInterfaces.CodeGeneration.LogicalFunctionFactory.generateFunction(LogicalFunctionFactory.java:35)
Caused by: java.lang.NoSuchFieldException: override
	at java.base/java.lang.Class.getDeclaredField(Class.java:2417)
	at net.openhft.compiler.CompilerUtils.<clinit>(CompilerUtils.java:60)
	... 14 more

java.lang.NoSuchFieldException: override occured when calling CompilerUtils.CACHED_COMPILER.loadFromJava.

Is it issue with my code or with compiler on Java 12?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions