Steve Ebersole
07/31/2025, 6:01 PMpublic abstract class HibernateOrmSpec {
...
@Optional
abstract public Property<EnhancementSpec> getEnhancement();
public void enhancement(Action<EnhancementSpec> action) {
EnhancementSpec spec = getObjectFactory().newInstance( EnhancementSpec.class );
action.execute( spec );
getEnhancement().set( spec );
}
}
abstract public class EnhancementSpec {
abstract public Property<Boolean> getEnableLazyInitialization();
...
}
Later, I try to see if the user specified this "enhancement" extension : if ( !getEnhancement().isPresent() ) ...
The odd part is this...
This works as expected:
hibernate {
enhancement {
}
}
However, this does not:
hibernate {
enhancement
}
Now I can easily accept that this second form is "not valid". But the problem I am having is actually being able to recognize this situation to properly handle it (whether that be treat it as the first form, throw an exception, etc.). The problem is that, as far as I can tell, Gradle just ignores it (it being the "enhancement" token). Its not added to ext properties or anything like that.
Any idea what Gradle actually does with that?Octavia Togami
07/31/2025, 6:05 PMgetEnhancement(), as both Kotlin and Groovy support calling getters via a property name. I think it's technically valid in both to just have that as a standalone statement, as weird as it is.Steve Ebersole
07/31/2025, 6:07 PMSteve Ebersole
07/31/2025, 6:07 PM