-
Bug
-
Resolution: Done
-
Major
-
5.5.0.Final
-
None
Declaring a type that extends an imported declared type leads to Null Pointer.
According to the documentation at http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/ch04.html#d0e5060
it should be possible to declare:
import org.people.Person
declare Person end
declare Student extends Person end
However, adding the last line, leads to an NPE during readKnowledgeBase:
java.lang.NullPointerException
at org.drools.base.ClassTypeResolver.resolveType(ClassTypeResolver.java:130)
at org.drools.compiler.PackageBuilder.isNovelClass(PackageBuilder.java:2291)
at org.drools.compiler.PackageBuilder.generateDeclaredBean(PackageBuilder.java:2473)
at org.drools.compiler.PackageBuilder.processTypeDeclarations(PackageBuilder.java:2133)
at org.drools.compiler.PackageBuilder.mergePackage(PackageBuilder.java:1272)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:869)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:466)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:694)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40)
at com.sample.DroolsTest.main(DroolsTest.java:23)
To reproduce simply:
- Create a Drools Project
- Add the following lines to Sample.drl
declare Message end
declare Any extends Message end - Run