[rules-users] Drools causes switch(enum e) to break?
SydneyTechHead
duncanlyon at gmail.com
Mon May 5 08:18:23 EDT 2014
I've reproduced this issue with a simple example:
1. Create a new "Drools Project" in Eclipse Kepler with Drools 6.0.1.Final
installed (JDK 1.7) with simple "Hello World" rule example. Project builds
OK.
2. Create the following new class:
public class EnumTest {
private enum EnumType { On, Off }
private EnumType et = EnumType.On;
public EnumTest() {}
public String TypeText()
{
switch(et)
{
case On:
return "On";
case Off:
return "Off";
default:
return "";
}
}
}
3. Rebuild project. Eclipse reports Problem:
Drools Error: "Cannot switch on a value of type EnumTest.EnumType. Only
convertible int values or enum variables are permitted"
4. Export Ant Build file for the project and run the Ant Build. Build
successful.
5. Create a vanilla Java Project (no Drools) and add the same EnumTest
class. Eclipse project builds OK.
As the project builds OK via Ant, it appears that this is an issue with the
Eclipse incremental builder conflicting with Drools 6. As noted in my
previous post, it appears that Eclipse may be reducing JDK compiler
compliance level down to 1.5 or referencing JRE 1.5 in class path as a
result of this conflict, as I've occasionally noticed it changing these
settings in project properties.
Any ideas or clues why this may be the case and what is the best channel to
report this Eclipse issue?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-causes-switch-enum-e-to-break-tp4029233p4029427.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list