Home » Modeling » TMF (Xtext) » problems with the OnTheFlyJavaCompiler
problems with the OnTheFlyJavaCompiler [message #883856] |
Sat, 09 June 2012 15:41 |
|
Hi
I'm using the CompilationTestHelper (which relies on
OnTheFlyJavaCompiler) for testing that the generated Java code for my
DSL is Java correct; this works fine but for one case: in my DSL for
each input "entity" I generate two Java classes, say, a.A1 and a.b.A2,
where A2 "depends" on A1 (e.g., it has a field of type A1). When
CompilationTestHelper compiles A1 everything goes fine; when then it
compiles A2 the java compiler says it cannot find A1.
By debugging I found one problem:
- the classpath used by the OnTheFlyJavaCompiler does not contain the
temporary folder (where a.A1.class was compiled), and I can deal with
that with an injected custom OnTheFlyJavaCompiler which does
@Override
public String getClasspathArgs() {
final String classpathArgs = super.getClasspathArgs();
return classpathArgs
+ (classpathArgs.isEmpty() ? "" : File.pathSeparator +
createTempDir().getAbsolutePath() + File.separator);
}
this way, if I manually call the java compiler (javac) from the command
line (while the junit test is stopped in debugging mode and the java
file for A2 is in the temporary folder), everything compiles fine.
However,
- In spite of the now correct classpath, the OnTheFlyJavaCompiler still
complains that it cannot find A1, while compiling A2...
Is there any workaround?
thanks in advance
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Re: problems with the OnTheFlyJavaCompiler [message #884468 is a reply to message #883856] |
Mon, 11 June 2012 06:17 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
Hi Lorenzo,
could you please file a bugzilla?
Thanks,
Sven
Am 6/9/12 5:41 PM, schrieb Lorenzo Bettini:
> Hi
>
> I'm using the CompilationTestHelper (which relies on
> OnTheFlyJavaCompiler) for testing that the generated Java code for my
> DSL is Java correct; this works fine but for one case: in my DSL for
> each input "entity" I generate two Java classes, say, a.A1 and a.b.A2,
> where A2 "depends" on A1 (e.g., it has a field of type A1). When
> CompilationTestHelper compiles A1 everything goes fine; when then it
> compiles A2 the java compiler says it cannot find A1.
>
> By debugging I found one problem:
>
> - the classpath used by the OnTheFlyJavaCompiler does not contain the
> temporary folder (where a.A1.class was compiled), and I can deal with
> that with an injected custom OnTheFlyJavaCompiler which does
>
> @Override
> public String getClasspathArgs() {
> final String classpathArgs = super.getClasspathArgs();
> return classpathArgs
> + (classpathArgs.isEmpty() ? "" : File.pathSeparator +
> createTempDir().getAbsolutePath() +
> File.separator);
> }
>
> this way, if I manually call the java compiler (javac) from the command
> line (while the junit test is stopped in debugging mode and the java
> file for A2 is in the temporary folder), everything compiles fine.
>
> However,
>
> - In spite of the now correct classpath, the OnTheFlyJavaCompiler still
> complains that it cannot find A1, while compiling A2...
>
> Is there any workaround?
>
> thanks in advance
> Lorenzo
>
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Re: problems with the OnTheFlyJavaCompiler [message #884528 is a reply to message #884468] |
Mon, 11 June 2012 09:03 |
|
Yes,
in the meantime a possible solution I found was to compile all the java
sources in a single command (using a custom OnTheFlyJavaCompiler); I'll
file the bug ASAP.
cheers
Lorenzo
On 06/11/2012 08:17 AM, Sven Efftinge wrote:
> Hi Lorenzo,
>
> could you please file a bugzilla?
>
> Thanks,
> Sven
>
> Am 6/9/12 5:41 PM, schrieb Lorenzo Bettini:
>> Hi
>>
>> I'm using the CompilationTestHelper (which relies on
>> OnTheFlyJavaCompiler) for testing that the generated Java code for my
>> DSL is Java correct; this works fine but for one case: in my DSL for
>> each input "entity" I generate two Java classes, say, a.A1 and a.b.A2,
>> where A2 "depends" on A1 (e.g., it has a field of type A1). When
>> CompilationTestHelper compiles A1 everything goes fine; when then it
>> compiles A2 the java compiler says it cannot find A1.
>>
>> By debugging I found one problem:
>>
>> - the classpath used by the OnTheFlyJavaCompiler does not contain the
>> temporary folder (where a.A1.class was compiled), and I can deal with
>> that with an injected custom OnTheFlyJavaCompiler which does
>>
>> @Override
>> public String getClasspathArgs() {
>> final String classpathArgs = super.getClasspathArgs();
>> return classpathArgs
>> + (classpathArgs.isEmpty() ? "" : File.pathSeparator +
>> createTempDir().getAbsolutePath() +
>> File.separator);
>> }
>>
>> this way, if I manually call the java compiler (javac) from the command
>> line (while the junit test is stopped in debugging mode and the java
>> file for A2 is in the temporary folder), everything compiles fine.
>>
>> However,
>>
>> - In spite of the now correct classpath, the OnTheFlyJavaCompiler still
>> complains that it cannot find A1, while compiling A2...
>>
>> Is there any workaround?
>>
>> thanks in advance
>> Lorenzo
>>
>
>
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Re: problems with the OnTheFlyJavaCompiler [message #894969 is a reply to message #884468] |
Wed, 11 July 2012 09:29 |
|
https://bugs.eclipse.org/bugs/show_bug.cgi?id=384809
On 06/11/2012 08:17 AM, Sven Efftinge wrote:
> Hi Lorenzo,
>
> could you please file a bugzilla?
>
> Thanks,
> Sven
>
> Am 6/9/12 5:41 PM, schrieb Lorenzo Bettini:
>> Hi
>>
>> I'm using the CompilationTestHelper (which relies on
>> OnTheFlyJavaCompiler) for testing that the generated Java code for my
>> DSL is Java correct; this works fine but for one case: in my DSL for
>> each input "entity" I generate two Java classes, say, a.A1 and a.b.A2,
>> where A2 "depends" on A1 (e.g., it has a field of type A1). When
>> CompilationTestHelper compiles A1 everything goes fine; when then it
>> compiles A2 the java compiler says it cannot find A1.
>>
>> By debugging I found one problem:
>>
>> - the classpath used by the OnTheFlyJavaCompiler does not contain the
>> temporary folder (where a.A1.class was compiled), and I can deal with
>> that with an injected custom OnTheFlyJavaCompiler which does
>>
>> @Override
>> public String getClasspathArgs() {
>> final String classpathArgs = super.getClasspathArgs();
>> return classpathArgs
>> + (classpathArgs.isEmpty() ? "" : File.pathSeparator +
>> createTempDir().getAbsolutePath() +
>> File.separator);
>> }
>>
>> this way, if I manually call the java compiler (javac) from the command
>> line (while the junit test is stopped in debugging mode and the java
>> file for A2 is in the temporary folder), everything compiles fine.
>>
>> However,
>>
>> - In spite of the now correct classpath, the OnTheFlyJavaCompiler still
>> complains that it cannot find A1, while compiling A2...
>>
>> Is there any workaround?
>>
>> thanks in advance
>> Lorenzo
>>
>
>
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Goto Forum:
Current Time: Fri Apr 19 03:58:34 GMT 2024
Powered by FUDForum. Page generated in 0.02615 seconds
|