Return-Path: X-Original-To: apmail-openoffice-dev-archive@www.apache.org Delivered-To: apmail-openoffice-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 7CBB718AC2 for ; Sun, 8 Nov 2015 10:38:45 +0000 (UTC) Received: (qmail 98012 invoked by uid 500); 8 Nov 2015 10:38:45 -0000 Delivered-To: apmail-openoffice-dev-archive@openoffice.apache.org Received: (qmail 97932 invoked by uid 500); 8 Nov 2015 10:38:45 -0000 Mailing-List: contact dev-help@openoffice.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openoffice.apache.org Delivered-To: mailing list dev@openoffice.apache.org Received: (qmail 97921 invoked by uid 99); 8 Nov 2015 10:38:44 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Nov 2015 10:38:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 804CFC5437 for ; Sun, 8 Nov 2015 10:38:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.972 X-Spam-Level: X-Spam-Status: No, score=0.972 tagged_above=-999 required=6.31 tests=[SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.972, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id nERWw315stww for ; Sun, 8 Nov 2015 10:38:36 +0000 (UTC) Received: from biz75.inmotionhosting.com (biz75.inmotionhosting.com [74.124.218.126]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id B58892305B for ; Sun, 8 Nov 2015 10:38:35 +0000 (UTC) Received: from ip72-192-158-139.sd.sd.cox.net ([72.192.158.139]:49354 helo=[192.168.1.113]) by biz75.inmotionhosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.85) (envelope-from ) id 1ZvNMg-00032k-Td for dev@openoffice.apache.org; Sun, 08 Nov 2015 02:38:28 -0800 Subject: Re: [QUESTION] Getting to AOO for Java (AOO4J)? To: dev@openoffice.apache.org References: <004101d11994$4f9c69c0$eed53d40$@apache.org> From: Patricia Shanahan Message-ID: <563F2620.6080800@acm.org> Date: Sun, 8 Nov 2015 02:38:24 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-2.6 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - biz75.inmotionhosting.com X-AntiAbuse: Original Domain - openoffice.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - acm.org X-Get-Message-Sender-Via: biz75.inmotionhosting.com: authenticated_id: pats+patriciashanahan.com/only user confirmed/virtual account not confirmed Using some combination of general and special purpose tools to do the bulk of the conversion makes sense to me. In addition, once we have functionally correct Java code, refactoring for maintainability becomes easier. I am most familiar with the tools built into Eclipse: See http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-menu-refactor.htm Getting to good quality Java code might require a combination of manually-selected refactoring and tool creation to automate common cases. On 11/8/2015 12:58 AM, Damjan Jovanovic wrote: > Let's examine porting AOO to Java in more detail. > > Java can easily call C code with JNA and also easily call even C++ with > BridJ (https://github.com/nativelibs4java/BridJ) (with its sister project > JNAerator even generating Java code to compile/link yours against by > examining C/C++ header files), and Java can easily call any UNO component. > C/C++ on the other hand can only call Java with great pain using the Java > invocation API, but UNO wraps that for us, so a Java component can be > called as easily as any UNO component. So ideally the smallest unit of > granularity while converting should be an UNO component, and C++ -> Java > call flow should be avoided. > > The easiest way to avoid C++ -> Java calls is to convert top down, starting > with top level modules like main/desktop and working down. But if A uses B, > and A is ported to Java and calls B using JNA/BridJ, then when B is also > ported to Java, A's calls to B need to be ported from JNA/BridJ to pure > Java, so working top down, while easier, means a 2 phase porting process is > necessary. Porting modules that are only accessed via UNO, would avoid the > 2 phase problem as UNO would be used before and after; main/xmlsecurity > which is only accessed via UNO and needs the category B nss library, is on > the chopping block :-). > > The how of porting is maybe the most interesting. For the migration from > CppUnit to Google Test I did recently, the only reason I finished such a > massive undertaking in the time that I did, is that I quickly developed a > tool to parse source code and convert the API. The tens of thousands of > calls to CPPUNIT_ASSERT* in our source tree didn't require hundreds of > thousands of keystrokes. Most of my time was spent on the stuff that > couldn't be automated, like migrating makefiles, fixing failing tests, and > hooking the tests into the build. My migration attempt from dmake to gbuild > - 100% manually - has been a disaster by comparison: only main/formula was > migrated so far - even the tiny 4 file main/animations module mysteriously > crashes Impress when ported, and 1 test in main/tools doesn't link on > Windows... > > I only consider the port to Java feasible because it could be mostly > automated. A while ago I discovered cpp-to-java-source-converter ( > https://github.com/danfickle/cpp-to-java-source-converter), a compiler that > converts C++ to Java. It's written in Java, under the ASLv2. It uses the > C++ parser from the Eclipse CDT project. It's still incomplete, very slow, > full of errors, and it produces Java code even more complex than the C++ > was. But I played with it, fixed a few bugs, forked it ( > https://github.com/DamjanJovanovic/cpp-to-java-source-converter) and am > working on more improvements. And with some further work, I think it has > real potential. Obviously not all C++ code can be converted to Java: goto > statements, iterating a char pointer over a struct, and so on, but those > are rare and can always be converted manually. But for the rest, and with > some improvements to cpp-to-java-source-converter, the Java code produced > could be of very high quality: elimination of destructors that only release > memory, the rest converted to close() and RAII implemented as Java 7's > try-with-resources, pointer iteration converted to indexing or Java > iterators and possibly the enhanced for loop, etc. > > Also cpp-to-java-source-converter could be patched to output JNA or BridJ > calls from the converted Java, and maybe to even do some API remapping in > place of calls to C++ APIs, like change ::std::map to java.util.Map. > > Of course, it won't all be that easy: comments in the code would have to be > copied to Java manually (and hopefully translated from German), > preprocessor #define constants need research, some C++ idioms will be slow > in Java and need to be rewritten, etc. But I am hopeful that this is still > the most promising path, which will produce the highest quality Java code > in the shortest amount of time. > > Even if the goal is 100% Java, there would still be a long transition > period where we use C++ as well. We should also improve the user experience > with Java before porting anything to Java. Then maybe we should start by > porting the dodgy modules like xmlsecurity. > > Damjan > > On Sat, Nov 7, 2015 at 9:41 PM, Dennis E. Hamilton > wrote: > >> There has been suggestion, and some expressed support, for AOO becoming a >> Java application. >> >> I don't want to discuss the merits of this, but how it might be undertaken. >> >> 1. NO STANDING-STILL ASSUMPTION. My first assumption is that one can't >> cease Apache OpenOffice maintenance and support while something like a >> redevelopment on Java occurs. It is pretty unthinkable that development of >> a >> Java version can be accomplished inside the release cycle (even the past >> lengthy cycle), and that migration from AOO as we know it can't be done >> like >> throwing a switch on the universe. So, my first assumption, which one can >> challenge, is that any development of a Java version must happen separate >> from the ongoing support for the current AOO. >> >> 2. FORKING TO MAKE AOO4J? One could consider making a project fork. That >> doesn't make sense as an Apache project, going through incubation, having >> to >> do much from scratch. But one could make an independent fork of a >> Java-based AOO (near) workalike. It could be a GitHub project, for example. >> If it is to come back to Apache, it must be sort of managed as an Apache >> Project from the beginning, especially around license and code provenance >> (IP) considerations. That might be too hard. >> >> 3. EXPANDING THE ODF TOOLKIT PROJECT. This is my favorite. The Apache >> ODF >> Toolkit (incubating) project is Java-based already. It deals with some >> fundamentals about supporting the OpenDocument Format (ODF). One could >> imagine building up the modularization to the point where one could achieve >> Writer, Calc, ... etc., workalikes. There, AOO4J could be a demonstration >> of composition of a suite (or even standalone components with shared >> libraries). There are also available related applications for >> interoperability testing of the level of ODF support: Apache OpenOffice >> itself, LibreOffice, and Microsoft Office. The support for Microsoft >> Office >> native formats could come from the POI projects and other open-source >> resources. >> >> The test of capacity is then one of how (2) or (3) manages to grow into a >> thriving project. Meanwhile, AOO is sustained and there are no diversions >> until a natural migration occurs. >> >> How does any of that sound. It means that there would be no revolutionary >> disruption of the Apache OpenOffice project itself. >> >> - Dennis >> >>> -----Original Message----- >>> From: Dennis E. Hamilton [mailto:orcmid@apache.org] >>> Sent: Tuesday, October 20, 2015 15:36 >>> To: dev@openoffice.apache.org >>> Subject: RE: [QUESTION] Optional Java Use for Essential Functionality >>> >>> Summary of what this thread revealed, in-line. >>> >> [ ... ] >>> [orcmid] There were some unexpected responses to these questions. >>> >>> 2. One suggestion was to remove the dependencies on Java. >>> >>> 3. Other suggestions included increasing the dependencies on Java, >>> perhaps >>> going so far as to make AOO a Java application. >>> >> [ ... ] >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org >> For additional commands, e-mail: dev-help@openoffice.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org For additional commands, e-mail: dev-help@openoffice.apache.org