Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Cast behaviour with Native types(EOL language semantics)
Cast behaviour with Native types [message #1855535] Thu, 20 October 2022 01:39 Go to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

The block of code below is intended to perform a file copy. Debug output shows that all three native types are correctly created, using concrete classes.

However, the copy operation fails to recognize the types.

var a = new Native("java.io.File")("a").toPath();
var b = new Native("java.io.File")("b").toPath();
var Files = Native("java.nio.file.Files");
Files.copy(a,b);


Invalid number (or types) of arguments for operation 'copy': expected 'java.io.InputStream, java.nio.file.Path, java.nio.file.CopyOption[]' but got 'org.eclipse.epsilon.eol.dom.NameExpression, org.eclipse.epsilon.eol.dom.NameExpression'
	at (/home/jg/eclipse/epsilon-2-4/workspace/test/test.eol@8:0-8:16)
	at (/home/jg/eclipse/epsilon-2-4/workspace/test/test.eol@8:0-8:16)
	at (/home/jg/eclipse/epsilon-2-4/workspace/test/test.eol@1:0-8:16)
	at (/home/jg/eclipse/epsilon-2-4/workspace/test/test.eol@1:0-8:16)
Re: Cast behaviour with Native types [message #1855536 is a reply to message #1855535] Thu, 20 October 2022 02:08 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Is this using Statement.execute()?
Re: Cast behaviour with Native types [message #1855549 is a reply to message #1855536] Thu, 20 October 2022 08:51 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Jörn,

Unfortunately, there is no support in Epsilon for calling Java methods with vararg parameters at the moment. I've created an issue for this.

Thanks,
Dimitris

[Updated on: Thu, 20 October 2022 08:59]

Report message to a moderator

Re: Cast behaviour with Native types [message #1855610 is a reply to message #1855549] Sun, 23 October 2022 12:44 Go to previous messageGo to next message
Sina MadaniFriend
Messages: 160
Registered: November 2015
Location: York, UK
Senior Member
I've added support for this, hopefully haven't missed any edge cases.

[Updated on: Sun, 23 October 2022 12:44]

Report message to a moderator

Re: Cast behaviour with Native types [message #1855611 is a reply to message #1855610] Sun, 23 October 2022 12:47 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Thanks Sina!
Have you looked at Statement to perform the lookup? It could insulate you from edge cases. I will read your commit if I find time. At conference a.t.m.
Re: Cast behaviour with Native types [message #1855626 is a reply to message #1855611] Mon, 24 October 2022 09:55 Go to previous messageGo to next message
Sina MadaniFriend
Messages: 160
Registered: November 2015
Location: York, UK
Senior Member
Hi Jörn,

Epsilon uses a bespoke interpreter so using java.beans.Statement wouldn't make sense in our architecture. Here's a link to the commit if you're interested.

[Updated on: Mon, 24 October 2022 09:58]

Report message to a moderator

Re: Cast behaviour with Native types [message #1855627 is a reply to message #1855626] Mon, 24 October 2022 10:04 Go to previous messageGo to next message
Sina MadaniFriend
Messages: 160
Registered: November 2015
Location: York, UK
Senior Member
That said, it might be worth investigating whether we could replace some of our reflection code with Statement.execute as you suggest, it would probably simplify things.
Re: Cast behaviour with Native types [message #1855628 is a reply to message #1855627] Mon, 24 October 2022 10:51 Go to previous message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Reason I am suggesting it is that Statement.execute()s behaviour will de hawkishly watched to be in line with the JLS spec, as there is so much reliance on that.

As it comes from the runtime, it will be in sync with the JLS in force for that runtime, which would be the intended behaviour. ('just like the Java I use.')

Reflection code tends to be fraught with risks, as it is really hard to test. So offloading responsibility and effort seems a sensible move.
Previous Topic:EGL+EGX, Type not found
Next Topic:Executing EWL
Goto Forum:
  


Current Time: Sat Apr 27 07:53:02 GMT 2024

Powered by FUDForum. Page generated in 0.03214 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top