Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 64565 invoked from network); 3 Mar 2006 16:39:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Mar 2006 16:39:39 -0000 Received: (qmail 55621 invoked by uid 500); 3 Mar 2006 16:40:21 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 55567 invoked by uid 500); 3 Mar 2006 16:40:21 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 55556 invoked by uid 99); 3 Mar 2006 16:40:21 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 08:40:21 -0800 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=NO_OBLIGATION,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of gcjhd-harmony-dev@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 08:40:20 -0800 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FFDJ5-0007JG-Pc for harmony-dev@incubator.apache.org; Fri, 03 Mar 2006 17:39:07 +0100 Received: from gw-amb1.netreach.com ([204.9.98.14]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Mar 2006 17:39:07 +0100 Received: from stuart.a.ballard by gw-amb1.netreach.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Mar 2006 17:39:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: harmony-dev@incubator.apache.org From: Stuart Ballard Subject: Re: Understanding JAPI tools (was: Re: [jira] Created: (HARMONY-163) Three types in java.util.jar are not implemented in Harmony) Date: Fri, 3 Mar 2006 16:38:23 +0000 (UTC) Lines: 72 Message-ID: References: <2142752780.1141368699552.JavaMail.jira@ajax.apache.org> <44080FE5.9040706@gmail.com> <4408156A.7070502@gmail.com> <44084AFD.6080404@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 204.9.98.14 (Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7)) Sender: news X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Tim Ellison gmail.com> writes: > Stuart: is there some way to avoid JAPI taking inherited API signatures > into account when doing the diff? kinda like the javadoc tool. This is something of a Japi FAQ (I should probably put together a Japi FAQ page somewhere now that it's no longer the case that pretty much everyone using Japi is on the Classpath list ;) ). The answer is no, it doesn't do this, and I'm not going to implement it. The reason is that whether a method is overridden or not is *not* part of the public API. Javadoc documents it, sure, but that's not really sufficient to say whether it's part of the API or not - it's quite likely it was simply easier to write Javadoc that way (so it didn't have to go and find the doc comments in the superclass's source file, etc). The rules of binary compatibility say that moving a method up or down the class hierarchy is a completely compatible change. A method may be overridden, or not, purely for performance reasons and the behavior could be completely identical. For example, LinkedList.subList is not documented as being overridden, but if it's not, that guarantees that the iterator() method will always be at least O(N) where N is the startIndex that the sublist was created with. An overridden LinkedList.subList method could hang on to the start and end nodes of the list and provide an O(1) implementation of iterator(). As long as some effort was taken to ensure that serialization stayed compatible, there's no reason why a Free runtime shouldn't do that optimization even if Sun doesn't. I've also heard of cases where Sun documents a method as being overridden even though as far as any testing can determine, all it does is call super. There should be no obligation for any Free runtime to duplicate this inefficiency. It's also possible to implement a method that needs changed behavior in a subclass by making the superclass delegate some parts of its behavior to non-public methods, so the superclass method is unchanged but the subclass just overrides the non-public methods (obviously, this only works if the subclass is in the same package, but that's pretty common). Finally, it's possible (albeit unlikely) that even if there *was* an apparent need to override a method in a subclass because it has different behavior, there might be some weird optimization-related reason why somebody might want to actually write it as "if (this instanceof Whatever)" in the superclass. I can't see why that would happen, but if someone did that and got all the behavior right, they shouldn't be penalized for it in Japi. Basically, Japi's business is to test the coverage of the API, and it's a fundamental design decision that Japi will *not* be testing implementation details. I've done quite a lot of work fixing bugs where implementation details inadvertently get exposed in the Japi results and if I find any more I'll fix them too. I think this is *extremely* important because, among other things, it's the *only* reason I feel legally secure in distributing Japi files for the JDK. As long as they only contain functional information necessary for interoperability, they're uncopyrightable. If they start exposing copyrightable implementation details, they become derived works of the JDK, and illegal to distribute (or, technically, to even create in the first place). And potentially so do the results of the comparisons. And if you then use those comparisons to make decisions on what to implement in Harmony, it jeopardizes Harmony's cleanroom status too. (IANAL; the people who actually decide whether legal risks are acceptable might think this isn't actually a problem for Harmony, but *I* don't want to be responsible for it ;) ) The right way to ensure that you've overridden all the right methods is to test the *behavior* of those methods. Obviously this is a lot more work than a simple automated run via Japi or equivalent, but it's the only way to get meaningful results. Obviously since Japi is Free Software I can't prevent others from making a version that does this, but I hope I've shown why I think it would be a bad idea. Stuart.