StackLocatorTest in log4j-api-java9 has some tests to validate the Java 9 
StackLocator is working. You could add code that uses StackWalker right now if 
you want.

Ralph

> On Jun 28, 2019, at 6:37 AM, Matt Sicker <[email protected]> wrote:
> 
> Thanks for clarifying that. The failing test is one that I wrote long ago
> back when I thought they’d never remove the internal class, and the point
> of the test is to ensure the behavior of the caller class algorithm matches
> the internal API behavior. Realistically, a Java 9+ version of that test
> would compare the behavior directly to StackWalker, and then we can remove
> the original test whenever we require Java 11 or something.
> 
> On Fri, Jun 28, 2019 at 08:12, Ralph Goers <[email protected]>
> wrote:
> 
>> What is missing is the patch to the test that Matt provided. I tried
>> applying his changes manually and the test still failed for me. The problem
>> is the test is trying to use a class that doesn’t exist in Java 11. The
>> “fix” is to have unit automatically ignore those tests when the classes
>> don’t exist. However, as I said before, nothing has changed in this regard
>> from the past several releases which you voted +1 on. This means it is
>> suddenly important to you to validate that the build works in Java 11.
>> Respectfully, that is something you should have done way before the release
>> was cut.
>> 
>> Ralph
>> 
>>> On Jun 28, 2019, at 5:26 AM, Gary Gregory <[email protected]>
>> wrote:
>>> 
>>> On Fri, Jun 28, 2019 at 8:25 AM Gary Gregory <[email protected]>
>> wrote:
>>> 
>>>> Ah! You can force compilation to be skipped with '-Dmaven.main.skip' so
>>>> you can 'compile' and 'install' jars with Java 8 and then run 'mvn test
>>>> -Dmaven.main.skip' with Java 11 which gives me:
>>>> 
>>>> [INFO] Running org.apache.logging.log4j.util.StackLocatorUtilTest
>>>> WARNING: sun.reflect.Reflection.getCallerClass is not supported. This
>> will
>>>> impact performance.
>>>> [ERROR] Tests run: 7, Failures: 4, Errors: 1, Skipped: 0, Time elapsed:
>>>> 0.175 s <<< FAILURE! - in
>> org.apache.logging.log4j.util.StackLocatorUtilTest
>>>> [ERROR]
>>>> 
>> testStackTraceEquivalence(org.apache.logging.log4j.util.StackLocatorUtilTest)
>>>> Time elapsed: 0.035 s  <<< ERROR!
>>>> java.lang.NoClassDefFoundError: sun/reflect/Reflection
>>>>       at
>>>> 
>> org.apache.logging.log4j.util.StackLocatorUtilTest.testStackTraceEquivalence(StackLocatorUtilTest.java:36)
>>>> Caused by: java.lang.ClassNotFoundException: sun.reflect.Reflection
>>>>       at
>>>> 
>> org.apache.logging.log4j.util.StackLocatorUtilTest.testStackTraceEquivalence(StackLocatorUtilTest.java:36)
>>>> 
>>>> [ERROR]
>>>> testGetCallerClass(org.apache.logging.log4j.util.StackLocatorUtilTest)
>>>> Time elapsed: 0.001 s  <<< FAILURE!
>>>> java.lang.AssertionError: expected same:<class
>>>> org.apache.logging.log4j.util.StackLocatorUtilTest> was not:<null>
>>>>       at
>>>> 
>> org.apache.logging.log4j.util.StackLocatorUtilTest.testGetCallerClass(StackLocatorUtilTest.java:49)
>>>> 
>>>> [ERROR]
>>>> testLocateClass(org.apache.logging.log4j.util.StackLocatorUtilTest)
>> Time
>>>> elapsed: 0.002 s  <<< FAILURE!
>>>> java.lang.AssertionError: Incorrect class expected:<class
>>>> org.apache.logging.log4j.util.StackLocatorUtilTest> but was:<class
>>>> java.lang.Object>
>>>>       at
>>>> 
>> org.apache.logging.log4j.util.StackLocatorUtilTest.testLocateClass(StackLocatorUtilTest.java:97)
>>>> 
>>>> [ERROR]
>>>> 
>> testGetCallerClassViaAnchorClass(org.apache.logging.log4j.util.StackLocatorUtilTest)
>>>> Time elapsed: 0 s  <<< FAILURE!
>>>> java.lang.AssertionError: expected same:<class
>>>> org.junit.runners.BlockJUnit4ClassRunner> was not:<class
>> java.lang.Object>
>>>>       at
>>>> 
>> org.apache.logging.log4j.util.StackLocatorUtilTest.testGetCallerClassViaAnchorClass(StackLocatorUtilTest.java:89)
>>>> 
>>>> [ERROR]
>>>> 
>> testGetCallerClassViaName(org.apache.logging.log4j.util.StackLocatorUtilTest)
>>>> Time elapsed: 0 s  <<< FAILURE!
>>>> java.lang.AssertionError: expected same:<class
>>>> org.junit.runners.BlockJUnit4ClassRunner> was not:<null>
>>>>       at
>>>> 
>> org.apache.logging.log4j.util.StackLocatorUtilTest.testGetCallerClassViaName(StackLocatorUtilTest.java:80)
>>>> 
>>>> [INFO] Running org.apache.logging.log4j.util.StringBuildersTest
>>>> [INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
>>>> 0.093 s - in org.apache.logging.log4j.util.StringBuildersTest
>>>> [INFO] Running org.apache.logging.log4j.util.StringsTest
>>>> [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
>>>> 0.092 s - in org.apache.logging.log4j.util.StringsTest
>>>> [INFO] Running
>>>> org.apache.logging.log4j.util.SystemPropertiesPropertySourceTest
>>>> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
>>>> 1.966 s - in
>>>> org.apache.logging.log4j.util.SystemPropertiesPropertySourceTest
>>>> [INFO] Running org.apache.logging.log4j.util.Unbox1Test
>>>> [INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
>>>> 0.109 s - in org.apache.logging.log4j.util.Unbox1Test
>>>> [INFO] Running org.apache.logging.log4j.util.Unbox2ConfigurableTest
>>>> [WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 2, Time
>> elapsed:
>>>> 0.057 s - in org.apache.logging.log4j.util.Unbox2ConfigurableTest
>>>> [INFO]
>>>> [INFO] Results:
>>>> [INFO]
>>>> [ERROR] Failures:
>>>> [ERROR]   StackLocatorUtilTest.testGetCallerClass:49 expected
>> same:<class
>>>> org.apache.logging.log4j.util.StackLocatorUtilTest> was not:<null>
>>>> [ERROR]   StackLocatorUtilTest.testGetCallerClassViaAnchorClass:89
>>>> expected same:<class org.junit.runners.BlockJUnit4ClassRunner> was
>>>> not:<class java.lang.Object>
>>>> [ERROR]   StackLocatorUtilTest.testGetCallerClassViaName:80 expected
>>>> same:<class org.junit.runners.BlockJUnit4ClassRunner> was not:<null>
>>>> [ERROR]   StackLocatorUtilTest.testLocateClass:97 Incorrect class
>>>> expected:<class org.apache.logging.log4j.util.StackLocatorUtilTest> but
>>>> was:<class java.lang.Object>
>>>> [ERROR] Errors:
>>>> [ERROR]   LogManagerTest.testGetLogger:53 » UnsupportedOperation No
>> class
>>>> provided, and ...
>>>> [ERROR]   LogManagerTest.testGetLoggerForAnonymousInnerClass1:81 »
>>>> UnsupportedOperation ...
>>>> [ERROR]   LogManagerTest.testGetLoggerForInner:109 »
>> UnsupportedOperation
>>>> No class provi...
>>>> [ERROR]   LogManagerTest.testGetLoggerForStaticInner:119
>>>> ExceptionInInitializer
>>>> [ERROR]   LoggerTest.getFormatterLogger:231 » UnsupportedOperation No
>>>> class provided, an...
>>>> [ERROR]   LoggerTest.getLoggerByNullClass:413 » UnsupportedOperation No
>>>> class provided, ...
>>>> [ERROR]   LoggerTest.getLoggerByNullObject:419 » UnsupportedOperation No
>>>> class provided,...
>>>> [ERROR]   LoggerTest.getLoggerByNullString:425 » UnsupportedOperation No
>>>> class provided,...
>>>> [ERROR]   StackLocatorUtilTest.testStackTraceEquivalence:36
>>>> NoClassDefFound sun/reflect/...
>>>> [INFO]
>>>> [ERROR] Tests run: 640, Failures: 4, Errors: 9, Skipped: 3
>>>> [INFO]
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [INFO] Reactor Summary for Apache Log4j 2 2.12.0:
>>>> [INFO]
>>>> [INFO] Apache Log4j 2 ..................................... SUCCESS [
>>>> 0.792 s]
>>>> [INFO] Apache Log4j API Java 9 support .................... SUCCESS [
>>>> 6.927 s]
>>>> [INFO] Apache Log4j API ................................... FAILURE
>> [01:00
>>>> min]
>>>> [INFO] Apache Log4j Implementation Java 9 support ......... SKIPPED
>>>> ...
>>>> 
>>>> Running StackLocatorUtilTest from Eclipse fails for release-2.x and
>> passes
>>>> for master, so there must be something missing from release-2.x.
>>>> 
>>> 
>>> I should have written: "Running StackLocatorUtilTest *with Java 11.0.3*
>>> from Eclipse fails for release-2.x and passes for master, so there must
>> be
>>> something missing from release-2.x."
>>> 
>>> Gary
>>> 
>>> 
>>>> So my expectation is that tests should be made to pass with Java 11 (11
>> is
>>>> the current Oracle LTS version, as opposed to 12 and 13.)
>>>> 
>>>> At this point I do not know if the above indicates failure if I want to
>>>> use locations on Java 11 or if this is a bug in the tests.
>>>> 
>>>> Until then I am -0.
>>>> 
>>>> Gary
>>>> 
>>>> On Thu, Jun 27, 2019 at 8:54 PM Matt Sicker <[email protected]> wrote:
>>>> 
>>>>> The java setup has me blocked currently for developing more complicated
>>>>> code where I want to use inline test execution in my IDE. It’s not a
>>>>> blocker for building, though.
>>>>> 
>>>>> On Thu, Jun 27, 2019 at 19:51, Gary Gregory <[email protected]>
>>>>> wrote:
>>>>> 
>>>>>> On Thu, Jun 27, 2019 at 8:06 PM Ralph Goers <
>> [email protected]
>>>>>> 
>>>>>> wrote:
>>>>>> 
>>>>>>> So does this mean you won’t be voting on this release even though it
>>>>>>> behaves the same as the previous releases?
>>>>>>> 
>>>>>> 
>>>>>> I am struggling with it. I am still looking for a way to test with
>> Java
>>>>>> 11... it feels pretty bad that we cannot say anything about what
>>>>> happens on
>>>>>> Java >= 11. Any report of "I ran my app and it was fine" would not
>> give
>>>>> me
>>>>>> much confidence. I can't even get a clean set up in Eclipse (a
>> different
>>>>>> issue.) When I run all tests for various modules from Eclipse, a lot
>> of
>>>>>> tests fail (a different issue.) Our development set up is definitively
>>>>>> pushing the boundaries... Pondering some more...
>>>>>> 
>>>>>> Gary
>>>>>> 
>>>>>> 
>>>>>>> 
>>>>>>> Ralph
>>>>>>> 
>>>>>>>> On Jun 27, 2019, at 11:08 AM, Gary Gregory <[email protected]>
>>>>>>> wrote:
>>>>>>>> 
>>>>>>>> On Thu, Jun 27, 2019 at 2:06 PM Ralph Goers <
>>>>>> [email protected]>
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> What was the last release where you could build and test with Java
>>>>> 11?
>>>>>>>>> AFAIK this problem is not new to this release.
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> No idea, sorry.
>>>>>>>> 
>>>>>>>> Gary
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Ralph
>>>>>>>>> 
>>>>>>>>>> On Jun 27, 2019, at 10:54 AM, Gary Gregory <
>>>>> [email protected]>
>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>> Running the build on Java 8 was fine for me. I am concerned that
>>>>> it
>>>>>> is
>>>>>>>>> not
>>>>>>>>>> testable on Java 11 in the usual Maven way. I cannot find a way to
>>>>>> run
>>>>>>>>> the
>>>>>>>>>> tests without Maven deciding it needs to recompile everything.
>>>>>>>>>> 
>>>>>>>>>> Gary
>>>>>>>>>> 
>>>>>>>>>> On Thu, Jun 27, 2019 at 1:18 PM Ralph Goers <
>>>>>>> [email protected]>
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> The vote is a little over half-way through and so far only Remko
>>>>> has
>>>>>>>>>>> voted. I haven’t seen anything yet that would make me vote
>>>>> against
>>>>>> the
>>>>>>>>>>> release so we still need one more vote before tomorrow night. All
>>>>>> the
>>>>>>>>>>> issues found so far are very minor.
>>>>>>>>>>> 
>>>>>>>>>>> Matt, as I said I tried applying the changes you made to master,
>>>>>>>>> including
>>>>>>>>>>> the assert and the new matcher class but the test still failed.
>>>>> Any
>>>>>>>>> ideas?
>>>>>>>>>>> 
>>>>>>>>>>> Ralph
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> --
>>>>> Matt Sicker <[email protected]>
>>>>> 
>>>> 
>> 
>> 
>> --
> Matt Sicker <[email protected]>


Reply via email to