Hey there I have a question regarding a problem we...
# configuration-cache
r
Hey there I have a question regarding a problem we face with an enum in our build logic. We have this FeatureFlag enum in our build:
Copy code
package org.elasticsearch.test.cluster;

import org.elasticsearch.test.cluster.util.Version;

/**
 * Elasticsearch feature flags. Used in conjunction with {@link org.elasticsearch.test.cluster.local.LocalSpecBuilder#feature(FeatureFlag)}
 * to indicate that this feature is required and should be enabled when appropriate.
 */
public enum FeatureFlag {
    TIME_SERIES_MODE("es.index_mode_feature_flag_registered=true", Version.fromString("8.0.0"), null),
    FAILURE_STORE_ENABLED("es.failure_store_feature_flag_enabled=true", Version.fromString("8.12.0"), null),
    SEMANTIC_TEXT_ENABLED("es.semantic_text_feature_flag_enabled=true", Version.fromString("8.15.0"), null);

    public final String systemProperty;
    public final Version from;
    public final Version until;

    FeatureFlag(String systemProperty, Version from, Version until) {
        this.systemProperty = systemProperty;
        this.from = from;
        this.until = until;
    }
}
when building with configuration-cache enabled I see this error message:
Copy code
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: java.lang.IllegalStateException: Failed to create instance of org.elasticsearch.gradle.testclusters.ElasticsearchNode$FeatureFlag with args [es.index_mode_feature_flag_registered, 8.0.0, null]
        at org.gradle.configurationcache.serialization.codecs.JavaRecordCodec.decode(JavaRecordCodec.kt:47)
        at org.gradle.configurationcache.serialization.codecs.JavaRecordCodec$decode$1.invokeSuspend(JavaRecordCodec.kt)
        ... 163 more
Caused by: java.lang.NoSuchMethodException: org.elasticsearch.gradle.testclusters.ElasticsearchNode$FeatureFlag.<init>(java.lang.String,org.elasticsearch.gradle.Version,org.elasticsearch.gradle.Version)
        at org.gradle.configurationcache.serialization.codecs.JavaRecordCodec.decode(JavaRecordCodec.kt:45)
        ... 164 more
It seems like a general serialisation issue with gradle. Is there anyting we can do from our side to work around / fix this issue?
đŸ¥¹ 1
v
Interesting. Can you have a look at the
class
file of
FeatureFlag
? Are `enum`s now compiled to be subclasses of
java.lang.Record
? Because the
JavaRecordCodec
should only be used if that is the case.
Or was the feature flag maybe a record before and there is some stale state hanging around somewhere?
You also see in the message that it tries to give
es.index_mode_feature_flag_registered
as argument, not
es.index_mode_feature_flag_registered=true
like in your enum definition
r
ah I'm looking at the wrong FeatureFlag class đŸ˜„
đŸ¤¦
v
đŸ¤£
Ah, yeah, package is different too đŸ˜„