Return-Path: X-Original-To: apmail-groovy-users-archive@minotaur.apache.org Delivered-To: apmail-groovy-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B816183C8 for ; Fri, 18 Dec 2015 19:12:42 +0000 (UTC) Received: (qmail 90988 invoked by uid 500); 18 Dec 2015 19:12:37 -0000 Delivered-To: apmail-groovy-users-archive@groovy.apache.org Received: (qmail 90956 invoked by uid 500); 18 Dec 2015 19:12:37 -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 90946 invoked by uid 99); 18 Dec 2015 19:12:37 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Dec 2015 19:12:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 93AC61804AF for ; Fri, 18 Dec 2015 19:12:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id muXNZyesWO1z for ; Fri, 18 Dec 2015 19:12:35 +0000 (UTC) Received: from mail-ig0-f178.google.com (mail-ig0-f178.google.com [209.85.213.178]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 7B351201A4 for ; Fri, 18 Dec 2015 19:12:34 +0000 (UTC) Received: by mail-ig0-f178.google.com with SMTP id jw2so41628010igc.1 for ; Fri, 18 Dec 2015 11:12:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Wxjv2E5hzdBz5t/wMgnsWFbhWF0ainJx6uMhkW9yQjg=; b=Sptc7bmGagoca9nSYZLviSpjEx/3Xz5R6T5ZprRp7GbBkZuGECrRBd7FXR/IxdNYcp d7H2Vj7iU52L0nxmI1iHK5mlYIZAZpAJ37l1ADzVhiVC2U7FofB7/7VomNcYxnks4kcV 1kbhObhwAS/aD7w5s8NdeUZ6IeSW2uyEnWrOb8FL6CGTU8o+lCuHZS1Sp9VRz4klEMqg z50s4wn05L9fBWQCgl24C2YYK2h9uz6Y7Znslam9u/5g0koI342Cmandelif/CCCx8/9 6koYbeonpwhEXH6dNQ5leHRa7uMPwtU7lG/8v4ExuYzEO3uvEykGXWnb5l8u1o5X4SUh 4mtw== X-Received: by 10.50.97.39 with SMTP id dx7mr4724656igb.19.1450465953367; Fri, 18 Dec 2015 11:12:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.57.138 with HTTP; Fri, 18 Dec 2015 11:12:13 -0800 (PST) From: Gerald Wiltse Date: Fri, 18 Dec 2015 14:12:13 -0500 Message-ID: Subject: Question about GroovyClassLoader, Imoprt, and ContentAssist To: users@groovy.apache.org Content-Type: multipart/alternative; boundary=047d7b10d01be8ce9f052730ebb9 --047d7b10d01be8ce9f052730ebb9 Content-Type: text/plain; charset=UTF-8 This is my first post to the list. If it's inappropriate for questions like this, please let me know. Goal: I want to define groovy classes in .groovy files as part of a package, but without ever needing to compile them. Then, I want to define groovy scripts in the same package, import the class definitions from the nearby .groovy files, and execute the script... all without compilation (of the other groovy files with classes). Problem, This appears to be possible using GroovyClassLoader() (and several people have posted how-tos). However, the problem I have that nobody else seems to reference is that this strategy means that content assist will never be able to identify your classes and methods, and your code will be full of underlines, and receive no error checking. (eclipse and otherwise i would think). You might say "Thats just a side effect of using such a dynamic feature, how would eclipse be able to know?", but consider the following: As I was building my project, I was creating the scripts and the classes in the package just like normal a program. When I add my import statements for my custom classes, Eclipse recognizes everything and content assist is happy. However, despite content assist being satisfied, it hits a snag when I try to execute a script because eclipse returns: unable to resolve class (presumably because it's still only a groovy file, and not compiled to a class file). So, I looked around and it looks like I have to comment out the import statement, and then use groovyclassloader to parse the groovy file instead. However, this has the negative side effect of breaking content assist. Question: Are my conclusions above all basically correct? Suggestion: Is there any known way to have content-assist work along-side with GroovyClassLoader? Maybe some way to tell it to ignore failed imports or something? Gerald R. Wiltse jerrywiltse@gmail.com 248-893-9110 (c) 888-248-7095 (p) 888-272-6046 (f) --047d7b10d01be8ce9f052730ebb9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
This is my first post to the list. If it's inappr= opriate for questions like this, please let me know.=C2=A0

Goal: I want to define groovy cl= asses in .groovy files as part of a package, but without ever needing to co= mpile them. Then, I want to define groovy scripts in the same package, impo= rt the class definitions from the nearby .groovy files, and execute the scr= ipt... all without compilation (of the other groovy files with classes).

Problem, This appears to be possible usi= ng GroovyClassLoader() (and several people have posted how-tos). However, t= he problem I have that nobody else seems to reference is that this strategy= means that content assist will never be able to identify your classes and = methods, and your code will be full of underlines, and receive no error che= cking. (eclipse and otherwise i would think).=C2=A0

You might say "Thats just a side effect of using such a = dynamic feature, how would eclipse be able to know?", but consider the= following:

As I was building my proje= ct, I was creating the scripts and the classes in the package just like nor= mal a program. When I add my import statements for my custom classes, Eclip= se recognizes everything and content assist is happy. However, despite cont= ent assist being satisfied, it hits a snag when I try to execute a script b= ecause eclipse returns: unable to resolve class (presumably because it'= s still only a groovy file, and not compiled to a class file).

So, I looked around and it looks like I have to c= omment out the import statement, and then use groovyclassloader to parse th= e groovy file instead. However, this has the negative side effect of breaki= ng content assist.

Question: Are my co= nclusions above all basically correct?

Suggestion: Is there any known way to have content-assist work along-side = with GroovyClassLoader? Maybe some way to tell it to ignore failed imports = or something?



Gerald R. Wiltse
jerrywiltse@gmail.com
248-893= -9110 (c)
888-248-7095 (p)
888-272-6046 (f)
--047d7b10d01be8ce9f052730ebb9--