Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353209 - [validation] Erroneous "cannot return from outside function or method" validation
Summary: [validation] Erroneous "cannot return from outside function or method" valida...
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: Web (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal with 23 votes (vote)
Target Milestone: 3.4   Edit
Assignee: Project Inbox CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
: 353198 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-27 10:00 EDT by Miguel Angel Garcia Grande CLA
Modified: 2012-08-29 12:27 EDT (History)
14 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Angel Garcia Grande CLA 2011-07-27 10:00:25 EDT
Build Identifier: 20110615-0604

When writing a "return" statement in a "on..." (onclick, for example) tag attribute, HTML & JSP validation incorrectly flags it with the message "cannot return from outside function or method".

Reproducible: Always

Steps to Reproduce:
1. Create an HTML or JSP file and open if with either with "Web Page Editor" or "HTML Editor/JSP Editor" (preferably the later).
2. Write the following content:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function foo() {
    return false;
}
</script>
</head>
<body>
    <button onfocus="return foo()">Push!!!</button>
</body>
</html>

3. Save the file.
4. If the error does not shows up, right click the file into the project tree and select "Validate". ("Web Page Editor" doesn't show the error until you do so).
Comment 1 Nitin Dahyabhai CLA 2011-07-27 13:41:44 EDT
*** Bug 353198 has been marked as a duplicate of this bug. ***
Comment 2 Mauro Molinari CLA 2011-09-24 13:03:55 EDT
I think this is a regression of WTP 3.3.0, because I don't remember I saw it in 3.2.x.
The problem is still present in WTP 3.3.1.
Comment 3 Nitin Dahyabhai CLA 2011-09-26 10:31:16 EDT
(In reply to comment #2)
> I think this is a regression of WTP 3.3.0, because I don't remember I saw it in
> 3.2.x.

No, I can reproduce this with the latest 3.2.5 I-build.
Comment 4 Adam Bowen CLA 2011-10-13 10:26:53 EDT
Still present in the latest WTP build:

Version: 3.3.0.v201103310011-7H7EFZ-DxumTla66ahfUnHfpsz0u5Z92pU4TxSL
Build id: 20110513100703
Comment 5 yinshangwei CLA 2011-12-16 07:15:46 EST
If the error does not shows up....
But the error still exists,how should I do?
Comment 6 Gus Heck CLA 2012-02-13 11:35:07 EST
I'm still seeing it with code like 

onclick="popupwindow('help.html'); return false;"

I've got over 100 of these, which means javascript validation is completely useless. Until this is fixed, Eclipse doesn't have javascript validation. Please consider increasing the severity of this bug. 

Eclipse Java EE IDE for Web Developers.

Version: Indigo Service Release 1
Build id: 20110916-0149

JavaScript Development Tools

Version: 1.3.1.v201108102009-7F78FXRFBBoPbXRPcHfz-uy
Build id: 20110915193224
Comment 7 Florian F CLA 2012-03-15 11:35:39 EDT
Please, someone, do something about it!

I am already unhappy with unnecessary warnings.  They are sometimes difficult to get rid of.  I am not happy when my "problems" window isn't empty.

Now when the IDE give me ERRORs, it drives me nuts.  I have to disable JSP validation completely else I cannot concentrate on real errors and real warnings.

I don't see why it should be so difficult to get rid of that particular warning.  It should be just a few lines to comment out.  Else, could you please move that warning to a category that I can disable?

Thanks.
Comment 8 David Cifuentes Garcia CLA 2012-04-12 05:49:13 EDT
I have the same problem, for example in lines like (in jsp):

"onkeypress="return checkFilter(event);"





Eclipse Java EE IDE for Web Developers.

Version: Indigo Service Release 1
Build id: 20110916-0149

JavaScript Development Tools

Version: 1.3.1.v201108102009-7F78FXRFBBoPbXRPcHfz-uy
Build id: 20110915193224
Comment 9 Nitin Dahyabhai CLA 2012-07-05 13:26:17 EDT
Please retry with Juno.
Comment 10 Miguel Angel Garcia Grande CLA 2012-07-06 01:56:06 EDT
Seems to work for me under Juno (Linux x86_64)

Thanks so much!!!! :-)
Comment 11 Victor Homyakov CLA 2012-07-06 03:10:45 EDT
Seems working in WTP 3.4.0 (both Eclipse 3.8 and 4.2).
Comment 12 David Cifuentes Garcia CLA 2012-07-06 04:13:58 EDT
It's working in June also for me :)
Comment 13 Nitin Dahyabhai CLA 2012-08-29 12:27:41 EDT
.