[Lazarus] Problem with JVM and/or native types

Sven Barth pascaldragon at googlemail.com
Sun Dec 25 14:26:02 CET 2011


Hello together!

I'm currently experimenting with the JVM port and I have a problem when 
navigating a source file of mine (Lazarus revision 34392). The 
problematic locations are marked with "// (number)" of which the error 
is explained below.

=== source begin ===

unit TrainData;

{$namespace org.sven.trainlog}
{$mode objfpc}{$H+}
{$modeswitch unicodestrings}

interface

uses
   AndroidR14;

type
   ETrainLogData = class(JLException) // (1)
   end;

   TTrainLogHelper = class(ADSSqliteOpenHelper) // (1)
   private
     const
       DatabaseVersion = 1;
       DatabaseName = 'trainlog';
       CreateTableTrainFamily = 'create table TrainFamily (' +
                                '  _id integer primary key autoincrement,' +
                                '  name varchar not null' +
                                ')';
       CreateTableTrainType = 'create table TrainType (' +
                              '  _id integer primary key autoincrement,' +
                              '  name varchar not null,' +
                              '  family_id integer not null' +
                              ')';
       CreateTableTrain = 'create table Train (' +
                          '  _id integer primary key autoincrement,' +
                          '  name varchar not null,' +
                          '  cnt integer not null default 0,' +
                          '  type_id integer not null' +
                          ')';
   public
     const
       ColumnTrainFamilyName = 'name';
       ColumnTrainTypeName = 'name';
       ColumnTrainName = 'name';
       ColumnTrainCount = 'cnt';

       TableTrainFamily = 'TrainFamily';
       TableTrainType = 'TrainType';
       TableTrain = 'Train';
   public
     constructor Create(aContext: ACContext); // (2)
     procedure onCreate(aDatabase: ADSSqliteDatabase); override;
     procedure onUpgrade(aDatabase: ADSSqliteDatabase;
       aOldVersion, aNewVersion: jint); override;

     function GetAllTrainFamilies: ADCursor;
     function GetTrainTypesByFamily(aFamily: jlong): ADCursor;
     function GetTrainsByType(aType: jlong): ADCursor;

     procedure AddTrainFamily(aName: String);
     procedure AddTrainType(aName: String);
     procedure AddTrain(aName: String);

     function GetNameOfFamily(aID: jlong): String;
     procedure SetNameOfFamily(aID: jlong; aNewName: String);
     function GetNameOfType(aID: jlong): String;
     procedure SetNameOfType(aID: jlong; aNewName: String);
     function GetNameOfTrain(aID: jlong): String;
     procedure SetNameOfTrain(aID: jlong; aNewName: String);
     function GetCountOfTrain(aID: jlong): jint;
     procedure SetCountOfTrain(aID: jlong; aNewCount: jint);

     procedure DeleteTrainFamily(aID: jlong);
     procedure DeleteTrainType(aID: jlong);
     procedure DeleteTrain(aID: jlong);
   end;

implementation

...

end.

=== source end ===

(1) here the message in the stdout when doing Ctrl+Click is:
### TCodeToolManager.HandleException: ": erwartet aber 'java.lang' 
gefunden" at Line=11763 Col=35 in 
"/mnt/data/source/fpc/fpc-jvm/rtl/android/jvm/androidr14.pas"
(2) here the message in the stdout when doing Ctrl+Shift+Down is:
### TCodeToolManager.HandleException: "; erwartet aber const gefunden" 
at Line=37 Col=5 in "/home/sven/projects/android/trainlog/traindata.pas"

Regards,
Sven




More information about the Lazarus mailing list