kt3k / kt3k/ebean-enhance-plugin
enhancement miss properties, inherited from another module
- Dominant language
- Kotlin
- Stars
- 4
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
There are multi-module gradle project, class hierarchy with `@MappedSuperclass` in parent module and class with `@Entity` in child module, that extends class from parent module.
When I run this construction from IDEA (15.0.5) with activated `Ebean ORM Enhancer` (4.9.2), all is fine.
But when I run gradle tasks, they fail with `java.lang.IllegalStateException: Property id not found in [...] for type class X.Y.Z at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.setBeanReflect(BeanDescriptorManager.java:1385)`.
As it turned out, this is because static field `_ebean_props` (of descripted bean) contains only properties defined in child module, but no properties inherited from parent module.
I build test case: module `parent` with classes `First`and `Second` that extends `First`. Module `child` with classes `Fourth`extends `Third`extends `Second`. `Fourth` is entity, other - mapped superclasses.
Test method:
```
@Test
public static void testMeta() throws Exception {
Class clazz = Fourth.class;
while (!clazz.equals(Object.class)) {
Field field = clazz.getField("_ebean_props");
String[] props = (String[]) field.get(null);
StringBuilder sb = new StringBuilder(clazz.getName());
sb.append(": ");
for (int i = 0; i < props.length; i++) {
sb.append(props[i]);
if (i < props.length - 1)
sb.append(", ");
}
log.info(sb.toString());
clazz = clazz.getSuperclass();
}
}
```
When test runs from IDEA output is
```
[TestNG] Running:
C:\Users\N\.IntelliJIdea15\system\temp-testng-customsuite.xml
13:37:17.927 [main] INFO ru.pokr.FourthTest - ru.pokr.Fourth: id, code, second, third, fourth
13:37:17.929 [main] INFO ru.pokr.FourthTest - ru.pokr.Third: id, code, second, third
13:37:17.929 [main] INFO ru.pokr.FourthTest - ru.pokr.Second: id, code, second
13:37:17.929 [main] INFO ru.pokr.FourthTest - ru.pokr.First: id, code
```
When runs gradle task :child:test output is
```
Testing started at 13:40 ...
13:40:43: Executing external task 'test'...
:parent:compileJava
:parent:enhanceEbeanMain
:parent:processResources UP-TO-DATE
:parent:classes
:parent:jar
:child:compileJava
:child:enhanceEbeanMain
:child:processResources UP-TO-DATE
:child:classes
:child:compileTestJava
:child:enhanceEbeanTest
:child:processTestResources UP-TO-DATE
:child:testClasses
:child:test
13:40:44.570 [Test worker] INFO ru.pokr.FourthTest - ru.pokr.Fourth: third, fourth
13:40:44.572 [Test worker] INFO ru.pokr.FourthTest - ru.pokr.Third: third
13:40:44.572 [Test worker] INFO ru.pokr.FourthTest - ru.pokr.Second: id, code, second
13:40:44.572 [Test worker] INFO ru.pokr.FourthTest - ru.pokr.First: id, code
BUILD SUCCESSFUL
```
Test project [https://github.com/npokr/test-ebean-plugin](url)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked test project and run the child module's :child:test Gradle task, comparing the generated _ebean_props output with the IDEA result. Trace the parent and child enhancement tasks; done means the child entity's generated properties include inherited properties from mapped superclasses and the test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100