Calsign / APDE

Source code for APDE: Create and run Processing sketches on an Android device.
GNU General Public License v2.0
338 stars 76 forks source link

New release #90

Closed EmmanuelPil closed 4 years ago

EmmanuelPil commented 4 years ago

I have tested the new release and have several issues, but I'll post them one by one. The first is; when I use settings I get the following error: Code:

void settings() {
  fullScreen();
}

void setup (){
}

  1. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/save_load_points/save_load_points.java (at line 87) public void settings() { ^^^^^^^^^^ Duplicate method settings() in type save_load_points

Tested on Kitkat 4.4 and Lollipop Samsung S4

Calsign commented 4 years ago

@EmmanuelPil Interesting. I'm surprised I haven't tested this to be honest.

This should be a pretty simple fix, not generating settings if it is already declared. I should be able to do it soon.

That being said, I'm a little surprised that you're using settings at all. You can put fullScreen into setup (because it doesn't use variables), or leave it out entirely (because APDE automatically adds it by default). It seems that the main reason for including settings would be for compatibility with desktop sketches? Or am I missing some use case here?

Thanks for testing this out, I really appreciate the feedback.

EmmanuelPil commented 4 years ago

I'm a little surprised that you're using settings at all

It seems that loading an app to the play store is not possible with current mode A4P PC But APDE does, however using settings() See here and here. That's why I use it. The second error I had in most of my sketches was

Syntax error on token "Invalid Character", delete this token

But after cleaning those "invisible" characters all is well, so it isn't actually an error, but this version is more demanding.

Calsign commented 4 years ago

@EmmanuelPil I see.

Do you know what the jnvalid whitespace character is (newline, tab, something else)? Could you send me a sample file that has the invalid characters?

EmmanuelPil commented 4 years ago

Here is a link to a function in sketch displaying invalid character. I've compared an original with a corrected sketch in a hex editor. This is the result of the first lines.

It seems to have something to do with

"=C2=A0" represents the bytes C2 A0. However, since this is UTF-8, it translates to 00A0, which is the Unicode for non-breaking space.

Calsign commented 4 years ago

@EmmanuelPil Hmm.

At first glance I can just replace all non-breaking spaces with regular spaces, just like it replaces CRLF newlines with LF. But on second thought this might not be the best idea, because non-breaking spaces are valid characters in Java strings and such an approach would be confusing for people that perhaps legitimately wanted to use non-breaking spaces in their strings.

I'm mostly surprised that these characters used to be accepted by APDE. They also appear to be rejected by the desktop PDE. As such I think rejecting them as invalid characters is the correct behavior (perhaps more correct than older versions of APDE).

If there's something I'm missing then please feel free to correct me, but this seems to be working as expected.

EmmanuelPil commented 4 years ago

As such I think rejecting them as invalid characters is the correct behavior (perhaps more correct than older versions of APDE).

I agree. My projects are quite large, so when about 20% of the code was red-underlined, it scared me. Most of the errors along the described above were of the type::

bluetooth [54]: Syntax error on token "}", delete this token The method onResume(l is undefined for the type ListView bt cannot be resolved draw [255]: The method header() is undefined for the type pcg15

It just didn't make sense. I solved it by opening a new sketch and copy/pasting it, from the original sketch, tab by tab. Since the popup menu Commment/Uncomment function does not work (and I use this a lot for debugging), I use external editors, and I think it´s there where the copying of invalid characters comes from. So after all, taking away the settings() issue it's all OK. Thank you for another greatly improved release.