You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "cclose1 (via GitHub)" <gi...@apache.org> on 2025/10/24 21:14:46 UTC
[I] Javascript private class variables error check [netbeans]
cclose1 opened a new issue, #8953:
URL: https://github.com/apache/netbeans/issues/8953
### Apache NetBeans version
Apache NetBeans 27
### What happened
Adding a duplicate private java script class variable causes a silent compilation failure.
### Language / Project Type / NetBeans Component
Javascript
### How to reproduce
Add following class to a js file
class Test {
#var1;
#var1;
}
Causes the js file containing it to not build without any error report. I had copied the variable meaning to change the copies name. Unfortunately I forgot to change the name and it took a long time to discover why. I accept having a private variable which duplicates another is an error, but surely it should fail the build with an error message.
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Windows 11
### JDK
Java EE 6 Web
### Apache NetBeans packaging
Apache NetBeans platform
### Anything else
_No response_
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "cclose1 (via GitHub)" <gi...@apache.org>.
cclose1 commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3573000103
Hi Matthias
Thank you for your response and I've tested the issue I raised and the
repeat definition results in an error indicator on the js file and the line
in error identified in the file.
In testing it I noticed something that indicates my analysis was in error
in that when you go into the Chrome debugger there is an error message
associated with line in error. I missed it because when testing I generate
trace output to the console log. The error I saw was a consequence of code
accessing something in the js file that was not generated as a result of
incorrect use of a private variable. If I had scrolled further up the
console log I would have seen the error that caused the later error.
It is however better to have errors indicated before you run the code. This
I guess is a consequence of Javascript not having a compilation stage that
verifies the code is valid Javascript. Mind you I'm not what valid
Javascript is, e.g. you can assign a string to a function. The assignment
does not fail but any code that calls the function does. Hard to see this
as an intended feature
Do you want me to close this issue on GitHub?
Regards Chris
On Thu, Nov 20, 2025 at 7:15 PM Matthias Bläsing ***@***.***>
wrote:
> *matthiasblaesing* left a comment (apache/netbeans#8953)
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3559645109>
>
> @cclose1 <https://github.com/cclose1> please have a look at #9027
> <https://github.com/apache/netbeans/pull/9027>. That changeset should fix
> many issues you raised. It is not a silver bullet, but ...
>
> You can test it with the nightly build from
> https://github.com/apache/netbeans/suites/50403112397/artifacts/4631072624
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3559645109>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABGZF25HXWWD2JYZVWGW3ED35YHM7AVCNFSM6AAAAACKE5KFJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKNJZGY2DKMJQHE>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3446567148
There is no compile step in the build phase. JS is copied to the final war and delivered to the browser, which then intprets it.
But! It should be possible to detect duplicate private declarations on the parser level.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing closed issue #8953: Javascript private class variables error check
URL: https://github.com/apache/netbeans/issues/8953
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3577068242
@cclose1 thanks for testing.
> Do you want me to close this issue on GitHub?
No, that will happen automatically when the PR is merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3457403952
This issue is correct, NetBeans should check for duplicate declarations of private variables. I'll probably have a look at that, just not right now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3559645109
@cclose1 please have a look at https://github.com/apache/netbeans/pull/9027. That changeset should fix many issues you raised. It is not a silver bullet, but ...
You can test it with the nightly build from https://github.com/apache/netbeans/suites/50403112397/artifacts/4631072624
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3448080963
> Given that private class properties were introduced about 2023, perhaps the
> handling of them has not been fully worked out. Failing to generate the js
> file is a less than helpful response.
YOU wrote the file. Nothing is generated at that point. The only thing NetBeans can do is tell YOU that the code YOU wrote is wrong. That indeed would be helpful, but is not implemented yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "cclose1 (via GitHub)" <gi...@apache.org>.
cclose1 commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3458081992
Hi Matthias
If you are going to work on this, which would be useful, I would point out
that there are other issues, e.g. assigning to an undeclared private
variable also causes destruction of the js file by the browser. I don't
know how many ways there are to misuse private variables, but for
completeness they should be included.
There is also another approach worth considering. I did a search, not
comprehensive, for javascript validators, to see how they would handle
these private variables issues. Most were not useful and were more like
coding standards checkers. However, https://piehost.com/tools/js-vaidator
looks promising. It gave sensible error messages for the duplicate private
variable and assignment to an undeclared private variable. Incorporating
such a validator in the build process would be useful and may not require
much work.
Regards Chris.
On Tue, Oct 28, 2025 at 4:32 PM Matthias Bläsing ***@***.***>
wrote:
> *matthiasblaesing* left a comment (apache/netbeans#8953)
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3457403952>
>
> This issue is correct, NetBeans should check for duplicate declarations of
> private variables. I'll probably have a look at that, just not right now.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3457403952>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABGZF25TFMEIJLB2QHBLR7L3Z6LAHAVCNFSM6AAAAACKE5KFJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINJXGQYDGOJVGI>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "cclose1 (via GitHub)" <gi...@apache.org>.
cclose1 commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3455522473
Hi Matthias
I accept that from the point of view of Netbeans, other than writing code
to check the validity of the js file, there is nothing that you can do. I
think the problem is with Javascript itself, but I don't know who, if
anyone, would be interested in solving it.
The following are some final observations.
I checked the war file and the relevant js is in it, so I guess that the
behaviour is down to the browser code. I use Chrome, but when I ran it on
Microsoft Edge, the same thing happened.
This feature makes use of private variables almost a waste of time. I now
have an approach to finding the code error. If it is not obvious from code
inspection, I comment out the body of the class and decrease the commented
out area until I find the line that triggers the failure. I tried this
recently and the error was that in a 7 character identifier, I'd typed an s
instead of a. When you are looking at many lines of code such errors are
hard to spot.
The thing that really surprises me is that, apart from
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_elements.
I've never seen anything to suggest private variables exist. I've seen lots
of java class code examples and I don't recall ever seeing one used. Lots
of use of __var, which is the convention for indicating a private variable.
Never seen anyone complaining about a problem with them.
I'm beginning to think that I'm the only one using them. Can that really be
the case? The pragmatic thing to do is to stop using them and switch back
to using __. From a purist point private class members and variables are
appealing.
From my perspective this issue can be closed.
Thanks for your prompt responses.
Regard Chris
On Sun, Oct 26, 2025 at 7:13 AM Matthias Bläsing ***@***.***>
wrote:
> *matthiasblaesing* left a comment (apache/netbeans#8953)
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3448080963>
>
> Given that private class properties were introduced about 2023, perhaps the
> handling of them has not been fully worked out. Failing to generate the js
> file is a less than helpful response.
>
> YOU wrote the file. Nothing is generated at that point. The only thing
> NetBeans can do is tell YOU that the code YOU wrote is wrong. That indeed
> would be helpful, but is not implemented yet.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3448080963>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABGZF24NQB6RSGFI6GEQNQT3ZRRCJAVCNFSM6AAAAACKE5KFJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINBYGA4DAOJWGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] Javascript private class variables error check [netbeans]
Posted by "cclose1 (via GitHub)" <gi...@apache.org>.
cclose1 commented on issue #8953:
URL: https://github.com/apache/netbeans/issues/8953#issuecomment-3447699068
Hi Matthias
Thanks for your response.
At the time I was aware that to use the term compile was inappropriate.
But there does seem to be an inadequacy in the handling of private class
variables. E.g. in the example, if I had used _var1 instead of #var1, there
would not have been a problem, as it seems the second _var1 is ignored. I
now know that if the js file is not listed by the debugger, I need to work
out what I've done wrong. This can be difficult as I'm not sure what the
rules are.
Given that private class properties were introduced about 2023, perhaps the
handling of them has not been fully worked out. Failing to generate the js
file is a less than helpful response.
I find it hard to believe that I'm the first person to raise an issue about
this. I would be interested to know if that is the case.
I now feel I know enough to solve such problems in the future, but a little
help would be appreciated.
Regards Chris
On Sat, Oct 25, 2025 at 12:19 PM Matthias Bläsing ***@***.***>
wrote:
> *matthiasblaesing* left a comment (apache/netbeans#8953)
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3446567148>
>
> There is no compile step in the build phase. JS is copied to the final war
> and delivered to the browser, which then intprets it.
>
> But! It should be possible to detect duplicate private declarations on the
> parser level.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/netbeans/issues/8953#issuecomment-3446567148>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABGZF24EH7UOUSKQ3TZQYWT3ZNMDBAVCNFSM6AAAAACKE5KFJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINBWGU3DOMJUHA>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists