apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.62k stars 841 forks source link

Invalid error detection in Javascript syntax #7260

Open grelf-net opened 4 months ago

grelf-net commented 4 months ago

Apache NetBeans version

Apache NetBeans 21

What happened

for (let i = 0; i < cellsInRange.length; i++)
  { let ci = cellsInRange[i];
    if (!ci.cell.open)
    { let ims = ci.cell.getWallImages();
      let data = [
        {s:ci.sxydNW, i:ims[0]},//Bug in NetBeans!
        {s:ci.sxydNE, i:ims[1]},//It says ims is an undeclared global
        {s:ci.sxydSW, i:ims[2]},//OK in browser though
        {s:ci.sxydSE, i:ims[3]}];
      data.sort(function(a, b) {return b.s.d - a.s.d;}); // Descending distance
      this.drawWall(data[1].s, data[3].s, data[1].i, ci.fogNo);
      this.drawWall(data[2].s, data[3].s, data[2].i, ci.fogNo);
  } }

Language / Project Type / NetBeans Component

HTML5/Javascript project (vanilla, for browser use)

How to reproduce

Screenshot 2024-04-11 155614

Did this work correctly in an earlier version?

Apache NetBeans 18

Operating System

WIndows 11 latest

JDK

JDK 11

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

Every time. If I change the let ims to var ims it is OK. The error is in NetBeans syntax checker.

Are you willing to submit a pull request?

No

grelf-net commented 4 months ago

Sorry - it did NOT work correctly in NB 18. That's what I was using when I found the problem. That prompted me to upgrade to 21 and the problem was still there. I have used NetBeans for many years without any such problems.

matthiasblaesing commented 4 months ago

Lets reopen - I'll see what to do about this.

grelf-net commented 4 months ago

I should perhaps add that there is no other variable or property called ims that might be confusing things. Also that I have tested the code in FireFox, Edge, and the built-in WebKit browser and they all work fine, finding the variable ims as required.

matthiasblaesing commented 4 months ago

This is not reproducible in current build:

image

Please check with the nightly build available here:

https://ci-builds.apache.org/job/Netbeans/job/netbeans-linux/lastSuccessfulBuild/artifact/nbbuild/

Please note:

  1. The ZIP in the referenced folder holds the ZIP Distribution of NetBeans. Expand it and you find a netbeans folder with the full installation.
  2. You need at least JDK 17 to run NetBeans 22 (on my main machine and @work I'm on Amazon Corretto 21)
  3. If the JDK can't be automatically found, uncomment the line with the variable netbeans_jdkhome in the file netbeans/etc/netbeans.conf and set the a path to the JDK there. On my windows test system for example it currently reads (with Amazon Corretto 17): image