Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 50403 invoked from network); 23 Jan 2004 04:06:06 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 23 Jan 2004 04:06:06 -0000 Received: (qmail 41210 invoked by uid 500); 23 Jan 2004 04:05:46 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 41178 invoked by uid 500); 23 Jan 2004 04:05:46 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 41165 invoked from network); 23 Jan 2004 04:05:46 -0000 Received: from unknown (HELO ca-exch01.actional.com) (63.101.113.162) by daedalus.apache.org with SMTP; 23 Jan 2004 04:05:46 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C3E166.0F54BF43" Subject: BeanShellDef - java.lang.LinkageError: duplicate class definition: AList Date: Thu, 22 Jan 2004 20:04:55 -0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: BeanShellDef - java.lang.LinkageError: duplicate class definition: AList Thread-Index: AcPhZiHMqftoQn6tQuSIZfxYEZbHmw== From: "Michael Sunde" To: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C3E166.0F54BF43 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, =20 I have been playing with the beanshelldef class defined by Peter in = thread: http://marc.theaimsgroup.com/?l=3Dant-dev = = &m=3D106577547220771&w=3D2 =20 Occasionally, I get a duplicate class definition error when using a task = defined by beanshelldef. I can reproduce the problem by using antcall. = The attached build file works fine if I call the 'test' target but fails = when the 'call' target is invoked. Is there a new version of = BeanShellDef with this problem fixed? It seems like beanshelldef is = executed twice. =20 Since we know the name of the task that is being created, is it possible = to delay the compilation of the beanshelldef code until it is used, to = improve startup performance? =20 Ant version: 1.6 BeanShell: 2.0beta1 =20 This task has turned out to be extremely useful. I hope it makes it into = the next version of ant.=20 =20 Thanks, Michael =20 build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D import org.apache.tools.ant.Task; public class AList extends Task { String message =3D null; public void setMessage(String message) { this.message =3D message; } public void execute() { System.out.println("message is " + message); } } =20 =20 =20 =20 Error =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D E:\builds\sst2>ant call Buildfile: build.xml [test1] message is hello world [test1] message is Hello from Macro =20 call: [beanshelldef] java.lang.reflect.InvocationTargetException [beanshelldef] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native = Method) [beanshelldef] at = sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :39) [beanshelldef] at = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:25) [beanshelldef] at java.lang.reflect.Method.invoke(Method.java:324) [beanshelldef] at bsh.Reflect.invokeOnMethod(Unknown Source) [beanshelldef] at bsh.Reflect.invokeObjectMethod(Unknown Source) [beanshelldef] at bsh.BshClassManager.defineClass(Unknown Source) [beanshelldef] at bsh.ClassGeneratorImpl.generateClassImpl(Unknown = Source) [beanshelldef] at bsh.ClassGeneratorImpl.generateClass(Unknown Source) [beanshelldef] at bsh.BSHClassDeclaration.eval(Unknown Source) [beanshelldef] at bsh.Interpreter.eval(Unknown Source) [beanshelldef] at bsh.Interpreter.eval(Unknown Source) [beanshelldef] at bsh.Interpreter.eval(Unknown Source) [beanshelldef] at BeanShellDef.execute(BeanShellDef.java:95) [beanshelldef] at = org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306) [beanshelldef] at org.apache.tools.ant.Task.perform(Task.java:401) [beanshelldef] at org.apache.tools.ant.Target.execute(Target.java:338) [beanshelldef] at = org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:172)= [beanshelldef] at = org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:12= 6) [beanshelldef] at = org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382) [beanshelldef] at = org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:144) [beanshelldef] at = org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306) [beanshelldef] at org.apache.tools.ant.Task.perform(Task.java:401) [beanshelldef] at org.apache.tools.ant.Target.execute(Target.java:338) [beanshelldef] at = org.apache.tools.ant.Target.performTasks(Target.java:365) [beanshelldef] at = org.apache.tools.ant.Project.executeTarget(Project.java:1237) [beanshelldef] at = org.apache.tools.ant.Project.executeTargets(Project.java:1094) [beanshelldef] at org.apache.tools.ant.Main.runBuild(Main.java:669) [beanshelldef] at org.apache.tools.ant.Main.startAnt(Main.java:220) [beanshelldef] at = org.apache.tools.ant.launch.Launcher.run(Launcher.java:215) [beanshelldef] at = org.apache.tools.ant.launch.Launcher.main(Launcher.java:90) [beanshelldef] Caused by: java.lang.LinkageError: duplicate class = definition: AList [beanshelldef] at java.lang.ClassLoader.defineClass0(Native Method) [beanshelldef] at = java.lang.ClassLoader.defineClass(ClassLoader.java:502) [beanshelldef] at = java.lang.ClassLoader.defineClass(ClassLoader.java:431) [beanshelldef] ... 31 more [beanshelldef] bsh.InterpreterError: Unable to define class: = java.lang.reflect.InvocationTargetException [beanshelldef] at bsh.BshClassManager.defineClass(Unknown Source) [beanshelldef] at bsh.ClassGeneratorImpl.generateClassImpl(Unknown = Source) [beanshelldef] at bsh.ClassGeneratorImpl.generateClass(Unknown Source) [beanshelldef] at bsh.BSHClassDeclaration.eval(Unknown Source) [beanshelldef] at bsh.Interpreter.eval(Unknown Source) [beanshelldef] at bsh.Interpreter.eval(Unknown Source) [beanshelldef] at bsh.Interpreter.eval(Unknown Source) [beanshelldef] at BeanShellDef.execute(BeanShellDef.java:95) [beanshelldef] at = org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306) [beanshelldef] at org.apache.tools.ant.Task.perform(Task.java:401) [beanshelldef] at org.apache.tools.ant.Target.execute(Target.java:338) [beanshelldef] at = org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:172)= [beanshelldef] at = org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:12= 6) [beanshelldef] at = org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382) [beanshelldef] at = org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:144) [beanshelldef] at = org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306) [beanshelldef] at org.apache.tools.ant.Task.perform(Task.java:401) [beanshelldef] at org.apache.tools.ant.Target.execute(Target.java:338) [beanshelldef] at = org.apache.tools.ant.Target.performTasks(Target.java:365) [beanshelldef] at = org.apache.tools.ant.Project.executeTarget(Project.java:1237) [beanshelldef] at = org.apache.tools.ant.Project.executeTargets(Project.java:1094) [beanshelldef] at org.apache.tools.ant.Main.runBuild(Main.java:669) [beanshelldef] at org.apache.tools.ant.Main.startAnt(Main.java:220) [beanshelldef] at = org.apache.tools.ant.launch.Launcher.run(Launcher.java:215) [beanshelldef] at = org.apache.tools.ant.launch.Launcher.main(Launcher.java:90) =20 BUILD FAILED E:\builds\sst2\build.xml:33: Following error occured while executing = this line E:\builds\sst2\build.xml:5: Sourced file: inline evaluation of: `` = import org.apache.tools.ant.Task; public class AList extends Task = { . . . '' internal Error: Unable to define class: java. lang.reflect.InvocationTargetException : at Line: 3 : in file: inline = evaluation of: `` import org.apache.tools.ant.Task; public = class AList extends Task { . . . '' : public class AList ex tends Task { =20 Total time: 6 seconds =20 =20 =20 =20 ------_=_NextPart_001_01C3E166.0F54BF43--