Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1C590200C92 for ; Mon, 12 Jun 2017 10:19:47 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1AF79160BD9; Mon, 12 Jun 2017 08:19:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 604B1160BD6 for ; Mon, 12 Jun 2017 10:19:46 +0200 (CEST) Received: (qmail 99241 invoked by uid 500); 12 Jun 2017 08:19:44 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 99231 invoked by uid 99); 12 Jun 2017 08:19:42 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jun 2017 08:19:42 +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 23F59C0BB2 for ; Mon, 12 Jun 2017 08:19:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.021 X-Spam-Level: X-Spam-Status: No, score=-0.021 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id WgS3KLeJ52yr for ; Mon, 12 Jun 2017 08:19:40 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id DF6285F5B8 for ; Mon, 12 Jun 2017 08:19:39 +0000 (UTC) Received: from [192.168.1.121] ([195.141.68.118]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MPHrQ-1dFwqp0Fv6-004VAf for ; Mon, 12 Jun 2017 10:19:39 +0200 Subject: Re: Minecraft modding with Groovy: @CompileStatic not statically compiling fields ? To: users@groovy.apache.org References: <5b3f8b76-6486-49a3-2dd0-4ab695ac214e@gmail.com> From: Jochen Theodorou Message-ID: <307eb566-e6b2-e337-dca4-9bf1a0e8532b@gmx.org> Date: Mon, 12 Jun 2017 10:19:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <5b3f8b76-6486-49a3-2dd0-4ab695ac214e@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:maSMG/fzAt97CRBzKwXJfkB2TUNu1ArPCoqZQ2534hRxwIROQ06 oBUux1AarXwaHzmvhsrEXGnGcOrkfvQmtkARS7S60Wpf203/8ood92c5KZgSe20vZNRAXuk 31XqFvRoidWOSS76EkeS0jhHOS6pblyXiEjsQh1yvYd2sOYhRc4+UX0vADyLe3m2tTM03p5 PzjylfC50CBeKsvTIWKGA== X-UI-Out-Filterresults: notjunk:1;V01:K0:pxOVjuft7jY=:uGBMrWSuoUrNX4RCHVe6co qvi6AuFM+gPK3nX4do3u3ty4yzvCxNEMkXN6LoBfCzTqTZ9up8Zdm1hy/PIY3iKXsnr7wAelu kWY6CHQXpTILmmUfKd+XtpxN7aJqIkYA4s+AJuaw+3ie4JSC+Fue+H4hEypU/XuZLPWG6Qn2P H2omexUJRemluloiFf3Y6QjV8ymB0IGjzDSTZ3AdDV+ZOMoF4T19LFzRuD5Xd1nBPxV6+l2Xq 3me6ItABPGjR6hjsDQJwc7Mk8U4E2G9TCyhDdkzq22eoDyufl6yoBXtZaeT9sg71HXiI+zTyd jvM9cSvE+o/GSEsaMh76Pg8JHlNWtMyNlczzQNeFP2HWjTPrhIpy19OmyYzF52ME8fiyqElCH THZOFI0AM1gRG7yRvAoDJomKVuJlJHVzMEf0y1lfxkOHeMoYgIqxrH0BGHWM1luk33l5qGqgr mLKIyFaIFPqWZr77tCq9Lylnttq38SpU7fb5FyBBDkJNI+3+0g1ntmXRGwHnoGfgfoOybnY/G UVYqdfGpJ9YCNdGZv/3zht17gsHeW65GOFoIBVmU1yT+4TbRIRN5S14iAu7tNIZqQQ2gIzVz5 cs9sNcHnYLFfqezeuOrY+QVjBNVyM8VULpn70K4aeiFgYye1/NYHQiKR0RbhwAaSPhTPhukfz QiKrN2/hV1s0P0Pj02HodcqoJZdVg7uNYsIuZn8Jv/LN/PvWnfcmvptY3jo5ccyLrcCU8ES/e u+xvNMSLUk2OK47l0Ed8Bbb7UtjgG1jsgbbY06y5htdAObYGe97qZgrE6b/Mgpf3rAxVTMI+y gufouca archived-at: Mon, 12 Jun 2017 08:19:47 -0000 On 10.06.2017 21:52, Ahm Avoby wrote: > Hi, > > I am a Groovy developer at work, and am trying to switch my sons > Minecraft 1.11.2 project (Forge based) from Java to Groovy 2.4.11. Since > the generated class files need to be obfuscated to work with Minecraft, > I am using @CompileStatic, as suggested by another Minecraft developer, > so that the Forge obfuscator finds the field/method names in the class > files. This works in some cases, but when trying to access fields of the > base class (e.g. net.minecraft.entity.Entity) I am encountering > groovy.lang.MissingPropertyException|s. you need the obfuscation to be able to call into the obfuscated minecraft code I assume. It sounds very much like a bug if calling to a accessible super class field ends up in a MissingPropertyException. Is it possible for you to make a small example? Though I had assumed, that if you use forge, you do not need to do that anymore. Well, modding on minecraft is not unknown to me, but I never tried to mod myself. So of course I have no idea about the details. > I don't have much experience using @CompileStatic (nor with Minecraft > modding), but looking at the generated class files, it seems as if > property (same for fields) access is not compiled statically, but > remains a call to ScriptBytecodeAdapter.setProperty, with the property > name given as a string literal (ergo the obfuscator won't see it, and > the call in Minecraft will fail). I have explained this more in-depth > with code samples on minecraftforum.net, but did not get a reply ( > http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2828852-groovy-compilestatic-solution-not-working-when). Frankly, about every setProperty/getProperty call in @CompileStatic is not right and needs fixing. > Can anyone confirm to me that what I am seeing is the excpected > @CompileStatic behavior - so using @CompileStatic on all Groovy classes > is not the solution to modding Minecraft with Groovy - or if there is > something I can do differently ? That is not the expected behaviour, no. If you can provide samples, especially a small script, that shows the problem but has no other dependencies, you would help us to fix this. As for obfuscation in Groovy in general... I think it can be done, but there are some limitations, even with @CompileStatic. Our final goal for @CompileStatic is to have a runtime, that has only the minimum required dynamic elements, but right now we have a lot of methods, that you usually call, that have more a naming convention, than anything else. And such conventions do not translate to obfuscation well. For example doCall in Closure, asBoolean, and iterator are very central here, as they are called from the runtime dynamically even if @CompileStatic is used. But excluding those few would then already do the job.. well... in theory... if @CompileStatic does not fall back to a dynamic setProperty for a reason it should not do that of course. > I would also be grateful for any other suggestion at a solution - I > really would like to avoid having to revert the project back to its Java > version :-) depending on the problem we could fix it and ensure there is a speedy 2.4.12. Other solution my also require knowing the nature of the problem first bye Jochen