Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 34C94C1B8 for ; Wed, 26 Jun 2013 07:10:58 +0000 (UTC) Received: (qmail 98860 invoked by uid 500); 26 Jun 2013 07:10:58 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 98631 invoked by uid 500); 26 Jun 2013 07:10:52 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 98623 invoked by uid 99); 26 Jun 2013 07:10:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jun 2013 07:10:51 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ralph.goers@dslextreme.com designates 209.85.160.51 as permitted sender) Received: from [209.85.160.51] (HELO mail-pb0-f51.google.com) (209.85.160.51) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jun 2013 07:10:43 +0000 Received: by mail-pb0-f51.google.com with SMTP id um15so13635924pbc.24 for ; Wed, 26 Jun 2013 00:10:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=hu8Eu96NPWw3MP0ZIDWM5NoylTsO2JUlftYmYarSRMQ=; b=lFnwgqbGyQ6Ool+d63IlIR0tOphCPzV89JmN5qBgqfG1ZOTG6+nWh9EDLT7t9RrtPY bgK9ScKtJLVWMOnGQHMMSZQtsH5kU9GFNqTVoYw2ZbIrRpBZcRUU2tQr6KLatu8sAHhn CpGoqKcq42/Bb60yUuMnc4MdqQxjhI6tlY2U3nBIezaJqYAyA7o/QyOvraLB6tILQn6M pl7+uurRgozlHAs1GhJG4AYrU24QeNf9vt10LmFv+TRRFUNcG3ZCRXZHcQZsA4UkDDfi RhoKQC4XUgvoRxK0BH6n+tPHAbFHHjtjK1RlB3QCA0xLfOFCTSHXVVSus2LzoiVtMab2 aolw== X-Received: by 10.68.20.193 with SMTP id p1mr2532322pbe.218.1372230621903; Wed, 26 Jun 2013 00:10:21 -0700 (PDT) Received: from [10.252.62.126] ([216.133.135.211]) by mx.google.com with ESMTPSA id dg3sm26895304pbc.24.2013.06.26.00.10.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Jun 2013 00:10:20 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1283) Subject: Re: We have to stop using Reflection#getCallerClass(int) From: Ralph Goers In-Reply-To: <985F9F34-3256-4565-9BC7-1ED61B4F06B4@nicholaswilliams.net> Date: Wed, 26 Jun 2013 00:10:20 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <985F9F34-3256-4565-9BC7-1ED61B4F06B4@nicholaswilliams.net> To: "Log4J Developers List" X-Mailer: Apple Mail (2.1283) X-Gm-Message-State: ALoCoQm5+6m7x7U1LSJyYCOCXvnWcQ08WerIcHIwOv0gM9KSsr3V9y4buX384XC7BhdiECZ3iQac X-Virus-Checked: Checked by ClamAV on apache.org This won't break Log4j 1.x as it doesn't implement the features that use = this. However, I'm pretty sure it will also break Logback. Ralph On Jun 25, 2013, at 5:04 PM, Nick Williams wrote: > As some of you may know, sun.reflect.Reflection#getCallerClass(int) = was removed in Java 8 (it was replaced with no-arg = Reflection#getCallerClass(), which uses non-public @CallerSensitive). = This resulted in LOG4J2-245 [1] (EmptyStackException on Java 8), which = was resolved with using a backup option = (SecurityManager#getClassContext()) in the hopes that a replacement = would be found. I have been actively involved in discussions on the Java = 8 Core Libraries mailing list to replace this behavior with a public API = in Java 8 [2,3]. >=20 > It has now come to my attention that the changes to = Reflection#getCallerClass(...) have been back-ported to Java 7 now [4,5] = (effective 1.7.0_25, released in the last week or so). Since it's a = non-public API, they're free to do this any time they want, but it will = cause a nightmare for Log4j users using 1.7.0_25 and higher. Here are = the exact changes that were made: >=20 > 1) Added no-arg Reflection#getCallerClass() that uses back-ported = @CollerSensitive. > 2) Left Reflection#getCallerClass(int) in place, but it now THROWS an = UnsupportedOperationException (which is even worse ... the fix for = LOG4J2-245 won't pick this up and make it work for 1.7.0_25+ users). > 3) In Java 7 _only_ (won't work for Java 8) users can specify = jdk.reflect.allowGetCallerClass system property to enable = Reflection#getCallerClass(int). I submit this will not be an option our = users are willing to accept, but it is a temporary workaround. >=20 > Here's hoping they add a public API in Java 8 to make what we're using = this for easier (I'm pushing as hard as I can), but it looks like Java 7 = is broke for good. We should probably add in a check so that = getCallerClass is not used unless Java major version is 6. >=20 > I do not know how this change will impact Log4j 1.x. Hopefully it = won't. >=20 > Nick >=20 > [1] https://issues.apache.org/jira/browse/LOG4J2-245 > [2] = http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/018049.html= > [3] = http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/018353.html= > [4] = http://mail.openjdk.java.net/pipermail/jdk7u-dev/2013-June/006791.html > [5] = http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/018349.html= > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org > For additional commands, e-mail: log4j-dev-help@logging.apache.org >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org