User-Defined Types in Java

Frequently Asked Questions
Post Reply
Adrian_Hudnott
Posts: 9
Joined: Fri Aug 29, 2008 11:03 pm

User-Defined Types in Java

Post by Adrian_Hudnott » Wed Nov 25, 2009 8:57 pm

The old Rel web site had substantial information on Rel's capability to accept user-defined type definitions written in Java, but I can no longer find this information any more.

We have a student that wants to use the Date type defined in the provided TypeDate.d script, but an error message appears.

VAR TEST BASE RELATION{X Date} KEY{X};
ERROR: RelDatabase: openRelvar failed: ca.mb.armchair.rel3.exceptions.ExceptionFatal: Failed loading heading {X Date(0)}: ca.mb.armchair.rel3.languages.tutoriald.parser.ParseException: Encountered " "(" "( "" at line 1, column 8.
Was expecting one of:     "}" ...     "," ...      Line 1 ca.mb.armchair.rel3.exceptions.ExceptionFatal: RelDatabase: openRelvar failed: ca.mb.armchair.rel3.exceptions.ExceptionFatal: Failed loading heading {X Date(0)}: ca.mb.armchair.rel3.languages.tutoriald.parser.ParseException: Encountered " "(" "( "" at line 1, column 8. Was expecting one of:     "}" ...     "," ...      Line 1      at ca.mb.armchair.rel3.interpreter.Interpreter.run(Interpreter.java:71)      at ca.mb.armchair.rel3.interpreter.Interpreter.interpret(Interpreter.java:203)      at ca.mb.armchair.rel3.interpreter.Interpreter.interpret(Interpreter.java:213)      at ca.mb.armchair.rel3.interpreter.Interpreter.interpret(Interpreter.java:217)      at ca.mb.armchair.rel3.client.stream.ClientLocalConnection$2.execute(ClientLocalConnection.java:78)      at ca.mb.armchair.rel3.client.stream.ClientLocalConnection.send(ClientLocalConnection.java:42)      at ca.mb.armchair.rel3.client.stream.ClientLocalConnection.sendExecute(ClientLocalConnection.java:76)      at ca.mb.armchair.rel3.client.string.ClientLocal.sendExecute(ClientLocal.java:56)      at ca.mb.armchair.rel3.dbrowser.ui.PanelCommandline$36.doInBackground(PanelCommandline.java:1132)      at javax.swing.SwingWorker$1.call(Unknown Source)      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)      at java.util.concurrent.FutureTask.run(Unknown Source)      at javax.swing.SwingWorker.run(Unknown Source)      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)      at java.lang.Thread.run(Unknown Source)

Wondered if we're doing anything wrong?

Thanks.

Adrian

Dave
Site Admin
Posts: 361
Joined: Sun Nov 27, 2005 7:19 pm

Re: User-Defined Types in Java

Post by Dave » Thu Nov 26, 2009 2:42 pm

This is a bug. One of my students just ran across it too. It seems the most recent update to Rel which made some changes to Tutorial D user-defined types broke the Java user-defined types. This will be fixed in the next update. In the mean time, a Date defined as (for example) TYPE Date POSSREP {year INTEGER, month INTEGER, day INTEGER}; should do the job.

Adrian_Hudnott
Posts: 9
Joined: Fri Aug 29, 2008 11:03 pm

Re: User-Defined Types in Java

Post by Adrian_Hudnott » Thu Nov 26, 2009 7:05 pm

Cool. We much prefer the new Tutorial D native user-defined types anyway but I just thought I'd mention it since it's shipped as a demo example.

leaute
Posts: 1
Joined: Thu May 28, 2015 2:24 pm

Re: User-Defined Types in Java

Post by leaute » Thu May 28, 2015 2:44 pm

Impossible to define Date type in release 1.0.12. Here is the error message :

ERROR: RS0012: Creation of type Date failed: ca.mb.armchair.rel3.exceptions.ExceptionSemantic:
 RS0008: Unable to add operators for Database.RelUserCode.Date: 
ca.mb.armchair.rel3.exceptions.ExceptionSemantic: RS0004: Java error: cannot find symbol
  symbol:   class Date   location: class Database.RelUserCode.op_Date_:  in line 8 of: RegularFileObject[/home/gibus/BDD/Rel/Database/RelUserCode/op_Date_.java] Java error: cannot find symbol   symbol:   class Date   location: class Database.RelUserCode.op_Date_:  in line 10 of: RegularFileObject[/home/gibus/BDD/Rel/Database/RelUserCode/op_Date_.java]

It was OK in 1.0.11 release.

Dave
Site Admin
Posts: 361
Joined: Sun Nov 27, 2005 7:19 pm

Re: User-Defined Types in Java

Post by Dave » Thu May 28, 2015 3:08 pm

It's fixed in 1.0.13, which is getting closer to release.

Post Reply