Guillaume Dumont created LOG4J2-1937:
----------------------------------------

             Summary: Including log4j-core yields a compilation warning with 
-Xlint:all
                 Key: LOG4J2-1937
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1937
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.8.2
         Environment: MacOSX El Capitan
{code}
$> java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
{code}

            Reporter: Guillaume Dumont


It seems that starting from log4j2 (2.0+), including {{log4j-core}} to a 
project that invokes {{javac}} with the option {{-Xlint:all}} will show the 
warning below for all annotations in the project.

{noformat}
warning: No processor claimed any of these annotations: 
org.junit.Test,org.junit.Rule,org.junit.Ignore,org.junit.Before,org.junit.After
{noformat}

I could reproduce it using a small project by putting the following in the 
gradle file:
{code}
dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: 
'2.0'
}

tasks.withType(JavaCompile) {
    options.compilerArgs << "-Xlint:all"
}
{code}

After a lot of research, the only workaround that I've seen suggested is 
basically to suppress this warning by using {{-Xlint:-processing}} instead. 
However this warning is definitely triggered by log4j2, which makes me think 
that this is where the root cause lies. In term of concrete impact, the 
annotations seem to work correctly.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to