Bug 995018

Summary: Compiler failure when dialect is not specified in DRL
Product: [Retired] JBoss BRMS Platform 6 Reporter: Jiri Locker <jlocker>
Component: Business CentralAssignee: Walter Medvedeo <wmedvede>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Locker <jlocker>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: atangrin, etirelli, manstis, mfusco, pzapataf
Target Milestone: ER4   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:19:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Locker 2013-08-08 12:13:05 UTC
Description of problem:

Saving this rule in workbench:

rule 'Dummy rule'
//dialect 'mvel'
when
  a : Applicant()
then
  System.out.println(a);
end

triggers incremental build, which results with following error:

13:47:12,285 ERROR [org.drools.compiler.kie.builder.impl.AbstractKieModule] (pool-15-thread-4) Unable to build KieBaseModel:defaultKieBase
Rule Compilation error : [Rule name='Dummy rule']
	defaultpkg/Rule_Dummy_rule307182425.java (6:243) : Applicant cannot be resolved to a type

If you uncomment dialect option and save the rule the build will succeed. If you remove content of RHS the build will succeed too.

What about the error message? It doesn't help at all. Could that be improved?

Version-Release number of selected component (if applicable):
CR1 (community)

How reproducible:
always

Steps to Reproduce:
1. open Dummy rule in mortgages project
2. replace the content with rule in Description
3. save the rule and wait until incremental build finishes

Actual results:
Applicant cannot be resolved to a type

Expected results:
No error or better explanation if the rule is really invalid.

Additional info:

Comment 3 Edson Tirelli 2013-09-16 19:37:10 UTC
Mario, lets talk about this one and try to solve it ourselves, asking Michael if we need any guidance.

Comment 4 Pedro Zapata 2013-09-17 16:04:32 UTC
If a class has no package, it can't be imported.

On data modeler, we just have to force all classes to have a package. It's no longer possible to define a POJO in the default package.

The mortgate example in the uf-playground repo needs to be updated with this as well.

Comment 5 Mario Fusco 2013-09-17 16:59:35 UTC
I just enforced this constraint on the KieBuilder 

https://github.com/droolsjbpm/drools/commit/b9ff47c815714d2c5b1840b8e9a4ccaf2a3d3e24

Now if you try to compile a java class with no package declaration it will raise a compilation error.

Comment 6 Walter Medvedeo 2013-09-17 21:45:45 UTC
Data modeler objects creation was modified in order to prevent the creation of data objects without package. 

master branch: http://github.com/droolsjbpm/kie-wb-common/commit/569c667bb



6.0.x branch: http://github.com/droolsjbpm/kie-wb-common/commit/1ced2efe7

Comment 11 Jiri Locker 2013-10-18 09:21:42 UTC
Fixed in ER4.