I am getting close to my first successful build of the POI project, and have
run into a couple of compiler errors that seem to be blocking me. The first of
these is
Cannot reference a field before it is defined
This is caused 100 times in RecordTypes. java. How is it that other people are
getting this project to compile properly but not me? I am building in Eclipse
ver 2018-09 under Windows 10, using Java SE 1.8. The project is a copy of tag
REL_4_1_0 from the Git mirror of POI.
The following code illustrates this error. Ironically, while the error message
says that I am trying to reference a field, the error seems to be caused by a
method reference (UnknownRecordPlaceholder::new).
public final class SSCCE {
static class UnknownRecordPlaceholder {
}
enum RecordTypes {
// Error caused by next line
UnknownRecordPlaceholder(UnknownRecordPlaceholder::new);
@FunctionalInterface
public interface RecordConstructor {
void test();
}
public final RecordConstructor recordConstructor;
RecordTypes(RecordConstructor recordConstructor) {
this.recordConstructor = recordConstructor;
}
}
}