[jboss-jira] [JBoss JIRA] (DROOLS-2305) Drools compiler does not recognize Java 9

Jon Kranes (JIRA) issues at jboss.org
Wed Feb 7 12:49:00 EST 2018


    [ https://issues.jboss.org/browse/DROOLS-2305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13530205#comment-13530205 ] 

Jon Kranes commented on DROOLS-2305:
------------------------------------

[~mfusco]: the problem still occurs in 7.6.0.Final.  The root cause is the JavaDialectConfiguration class, which (still in 7.6.0.Final) contains the line


{code:java}
public static final String[]        LANGUAGE_LEVELS = new String[]{"1.5", "1.6", "1.7", "1.8"};
{code}

So it still does not recognize "9" as a valid language level string.

> Drools compiler does not recognize Java 9
> -----------------------------------------
>
>                 Key: DROOLS-2305
>                 URL: https://issues.jboss.org/browse/DROOLS-2305
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 7.5.0.Final
>            Reporter: Jon Kranes
>            Assignee: Mario Fusco
>
> The Drools compiler class org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration
>  does not include Java 9 as a valid language level.  Instead, when run using Java 9, the assumed java version is set to the default value of "1.7".
> As a consequence, when compiling a rules file requiring Java 8 specific language features, the compilation will fail.  For example, if a rule RHS contains the statement:
> {code:java}
> Arrays.asList("a","b","c").forEach(System.out::println);
> {code}
> The rule compilation fails with the error:
> {code:java}
> [ERROR] Unable to build KieBaseModel:default
> Rule Compilation error : [Rule name='test']
> 	defaultpkg/Rule_test959974052.java (7:387) : Method references are allowed only at source level 1.8 or above
> {code}
> The problem can be worked around by adding a configuration file META-INF/kie.properties.conf containing the line:
> {code:java}
> drools.dialect.java.compiler.lnglevel = 1.8
> {code}
> The Drools compiler code will use this value instead of the System "java.version" value, avoiding the problem.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list