Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003650 [JEDI VCL] 00 JVCL Components minor always 2006-04-20 06:03 2006-05-03 05:31
Reporter ivan_ra View Status public  
Assigned To ivan_ra
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0003650: Strange code in IvInterpreter
Description there is strange code introduced in rev.10397. This code "fixes" 0002676 and located in TJvInterpreterIdentifierList.Find:

  while (I <= Count - 1) and (AnsiStrIComp(PChar(TJvInterpreterIdentifier(List[I]).Identifier), PChar(Identifier)) = 0) do
   if SameText(TJvInterpreterMethod(List[I]).FClassType.ClassName, ClassName) then begin Index := I; exit; end else inc(I);

and some code in TJvInterpreterAdapter.GetValue.GetMethod
Additional Information New code in TJvInterpreterIdentifierList.Find finds method for class naming ClassName.
1) in common, this code is unsafe because TJvInterpreterIdentifier<>TJvInterpreterMethod
2) this code is unnecessary, because all methods sorted with inheritance (look at TJvInterpreterMethodList.Sort), so all methods saved in list by inheritance:

"Method"
"Method" from ancestor
"Method" from ancestors ancestor
...

So, original code does everything - it finds first ancestor's method, in particular, exactly objects class method first
Tags No tags attached.
Attached Files zip file icon JvInterpreter.zip [^] (51,906 bytes) 2006-04-21 03:58
? file icon JvInterpreter.pas.svn.patch [^] (1,983 bytes) 2006-04-21 09:29

- Relationships
related to 0003667resolvedivan_ra JvInterpreter: non-standard var params does not works 

-  Notes
(0009156)
ivan_ra (developer)
2006-04-20 10:31
edited on: 2006-04-20 10:31

Issue 0002676 was posted for beta version JVCL
It seems now this fix is unnecessary, and more, changes interface without need, and demonstrate bad style of programming

(0009158)
obones (administrator)
2006-04-20 11:18

But I did see the bug happening. So there was an issue. The code might be strange, that I agree. But it does work. If you have "cleaner" code, then please provide it.
(0009166)
ivan_ra (developer)
2006-04-21 03:56

Could you post example? I think error was in user application, not in Interpreter source code. Here is my example:
class TZtringList inherits from TStringList and sorts strings in descending order. It has interpreter adapter and works fine with "old good code" exactly as I wrote
(0009168)
ivan_ra (developer)
2006-04-21 09:28

I want to say what fix from 0002676 is harmless, but:
1) it does nothing new - all introduced logic is part of already implemented logic
2) it's changing interface without need - it's BAD

And this is "downgrading" patch for issue
(0009187)
obones (administrator)
2006-04-26 00:52

Ok, I must have mixed up two issues, I thought there was an example with 2676.
What is in the JvInterpreter.zip file you attached here?
(0009190)
ivan_ra (developer)
2006-04-26 05:16

This is example with descendant class to check up 0002676:

TZtringList = class (TStringList)
public
  procedure Sort; // not override
end;

This class has adapter and works in interpreter as in compiled code

1) after call of JvInterpreterMethodList.Sort methods sorted in this order:

TZtringList.Sort
TStringList.Sort

2) so, original method TJvInterpreterIdentifierList.Find always finds TZtringList.Sort before TStringList.Sort, and TJvInterpreterAdapter.GetValue.GetMethod exactly finds TZtringList.Sort for TZtringList and TStringList.Sort for TStringList

- Issue History
Date Modified Username Field Change
2006-04-20 06:03 ivan_ra New Issue
2006-04-20 10:31 ivan_ra Note Added: 0009156
2006-04-20 10:31 ivan_ra Note Edited: 0009156
2006-04-20 11:18 obones Note Added: 0009158
2006-04-20 11:18 obones Status new => feedback
2006-04-21 03:56 ivan_ra Note Added: 0009166
2006-04-21 03:58 ivan_ra File Added: JvInterpreter.zip
2006-04-21 09:28 ivan_ra Note Added: 0009168
2006-04-21 09:29 ivan_ra File Added: JvInterpreter.pas.svn.patch
2006-04-26 00:52 obones Note Added: 0009187
2006-04-26 05:16 ivan_ra Note Added: 0009190
2006-05-03 05:30 ivan_ra Relationship added related to 0003667
2006-05-03 05:31 ivan_ra Status feedback => resolved
2006-05-03 05:31 ivan_ra Resolution open => fixed
2006-05-03 05:31 ivan_ra Assigned To => ivan_ra


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker