java.lang.NoSuchMethodError: sugar.String.op_Implicit

IDE: _Visual Studio 2013
Version: 8.3.95.2031
Target (If relevant): Java
Description: java.lang.NoSuchMethodError: sugar.String.op_Implicit

In previous public version operations like assigning a char to string variable :

mystr := ',' ;

worked in my project. Now I get this error :

An exception of type: java.lang.NoSuchMethodError occurred
Message: {java.lang.NoSuchMethodError: sugar.String.op_Implicit(C)Ljava/lang/String;}

Expected Behavior:

mystr equals ‘,’

Actual Behavior:

error

Steps:

Cannot reproduce using simple project. Assigning more chars works.

Any ideas, what has changed? Sugar String class looks ok and the same as in previous version. I even recompiled the source but it didn’t help much (sometimes it helps) so it must be the compiler issue.

Artur

the only thing I can think of is somehow CopyLocal got set to false for sugar.jar?

This property is correct. Can I send you a project for testing on email?

Of course

To my surprise here is a project to reproduce :slight_frown:

namespace consoleapplication3;
interface

uses
  sugar.*,
  java.util;

type
  ConsoleApp = class
  public
    class method Main(args: array of String);
  end;

implementation

class method ConsoleApp.Main(args: array of String);
var
  s : String ;
begin
  s := ',' ;
end; 

The trick was to turn all Compatibility options on (Delphi mode) in the project settings !
consoleapplication3.zip (329.7 KB)

Thanks, logged as bugs://75971

I thought you were on the betas? 8.3 is way older?

We are on 8.3.93.1987 and wanted to switch to 8.3.95.2031 but it’s not possible. I tested the current beta 8.4 but it’s even worse while compiling our projects. Any chance to get fixed 8.3.93 ?

We did what was supposed to be the very last 8.3 release just last week. Any chance you can tell me whats wrong with 8.4 so I can make sure everything there works for you? (This particular issue doesn’t exist in 8.4)

  1. This issue also doesn’t work in 8.4 too. I checked on this simple project.
  2. On another project there is a problem with generics: (E62) Type mismatch, cannot assign “array of Object” to “array of T”
    TDictionary<T, U> = public class( java.util.TreeMap<T,U>, Iterable<Map.Entry<T, U>>)
      private
        method GetKeys: array of T;
    ……

      method TDictionary<T, U>.GetKeys: array of T;
      begin
        exit keySet.toArray();   //  error
      end ;

      method TDictionary<T, U>.GetValues: array of U;
      begin
        exit values.toArray();  //  error
      end ;
  1. On more complicated project (final) the VS crashes so I cannot finish compilation and report more errors for you.

Oke that is curious, did you force a rebuild? (or even clean/build)? I obviously tested this before I replied to you and it worked fine here, so need to find out what the differences are.[quote=“arturredzko, post:10, topic:10458”]

 TDictionary<T, U> = public class( java.util.TreeMap<T,U>, Iterable<Map.Entry<T, U>>)
      private
        method GetKeys: array of T;
    ……

      method TDictionary<T, U>.GetKeys: array of T;
      begin
        exit keySet.toArray();   //  error
      end ;

      method TDictionary<T, U>.GetValues: array of U;
      begin
        exit values.toArray();  //  error
      end ;

[/quote]

But that code really never was right to begin with, you’re upcasting an array. use something like:
exit values.toArray(new U[values.Length]);
(and make both getkeys/getvalues inline methods, that way you can do new U)

True, I made clean rebuild and indeed first case is fixed.
I fixed generics too - inline was the key. And finally after battle I run the main projects.
Now I fight with java.lang.VerifyError : method: CreateCopy signature, Incompatible type for getting or setting field.
I will get back to you later.

Yes, just give me few minutes to switch to VM and install again the beta.

  1.   This issue also doesn’t work in 8.4 too. I checked on this simple project.
    
  2.   On another project there is a problem with generics:     (E62) Type mismatch, cannot assign "array of Object" to "array of T"
    

TDictionary<T, U> = public class( java.util.TreeMap<T,U>, Iterable<Map.Entry<T, U>>)

private

method GetKeys: array of T;

……

method TDictionary<T, U>.GetKeys: array of T;

begin

exit keySet.toArray();   // <-- error

end ;

method TDictionary<T, U>.GetValues: array of U;

begin

exit values.toArray();  // <-- error

end ;

  1.   On more complicated project (final) the VS crashes so I cannot finish compilation and report more errors for you.

I fixed some code problems and it looks like 8.4 beta is compiling fine with my projects. The inlining is great for generic methods to solve errors like “type is not available at runtime”.
How can I get a version that we could use for production? You said that 8.3 is closed.

That’s great to hear. All our betas can be used for production. Last fridays build was very stable as we also installed it on our own build machines.

bugs://75971 got closed with status fixed.

So you recommend the current beta or we should wait for next build with new fixes? How long next stable release will take?

For now I would recommend to use last fridays build yes (unless there’s a specific fix that you don’t have yet and need). I’ll ask about the next stable release.

The debugging works but I had problems with code editor (no api help list, tips and cc, “Object reference not set to an instance of an object.” in Oxygene logs) for Java. I must verify it again.