Bug 257474 - [API] [exceptions] JSDT package's SimpleName class has a problem
Summary: [API] [exceptions] JSDT package's SimpleName class has a problem
Status: RESOLVED WONTFIX
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nitin Dahyabhai CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: needinfo
: 257456 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-12-04 01:42 EST by Wang Wei CLA
Modified: 2010-07-14 14:39 EDT (History)
4 users (show)

See Also:


Attachments
demo java source file (1.51 KB, text/plain)
2008-12-04 01:42 EST, Wang Wei CLA
no flags Details
project set file for JSDT Core (290 bytes, text/plain)
2009-04-28 19:30 EDT, Nitin Dahyabhai CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wang Wei CLA 2008-12-04 01:42:06 EST
Created attachment 119470 [details]
demo java source file 

Build ID: M20080911-1700

Steps To Reproduce:
"java.lang.IllegalArgumentException" happens when  there is an anonymouse function in the javasrcript file, 
and the exceptions will come out while using the plugin org.eclipse.wst.jsdt.core.dom.

1. Please use the source of attachment file, and run it.

2. The  exception  message of Output is:
============================================================

 java.lang.IllegalArgumentException
at org.eclipse.wst.jsdt.core.dom.SimpleName.setIdentifier(SimpleName.java:196)
at org.eclipse.wst.jsdt.core.dom.AST.newSimpleName(AST.java:898)
atcom.fujitsu.interstage.rcf.pageeditor.javascript.core.TestJsdtFunction.main(TestJsdtFunction.java:63)

============================================================

More information:
The problematic reasons of the current behavior :

1.SimpleName.java maybe add a Static variable :public static final int
NO_FUNCTION_NAME = 8;

2.TerminalTokens.java maybe add a variable :int  TokenNoNameIdentifier = 56;

3.SimpleName#setIdentifier(String identifier) may be fixed. 

*Line 188 : if (tokenType != TerminalTokens.TokenNameIdentifier) { may be
changed as following:
if (tokenType !=
TerminalTokens.TokenNameIdentifier&&tokenType!=TerminalTokens.TokenNoNameIdentifier)
{

*Line 192: if (scanner.currentPosition != length) { may be changed as
following:
if (scanner.currentPosition !=
length&&scanner.currentPosition!=NO_FUNCTION_NAME) {

Thank you so much for your patience and best regards!

Wang Wei
Comment 1 LuJing CLA 2008-12-04 01:45:29 EST
*** Bug 257456 has been marked as a duplicate of this bug. ***
Comment 2 Nitin Dahyabhai CLA 2009-04-28 19:30:05 EDT
Created attachment 133668 [details]
project set file for JSDT Core

Wang, I greatly appreciate the suggested changes in comment 0, but they really should be attached as a patch if we're going to accept them.

You can do so by importing the attached team project set file (File menu, Import..., choose "Team Project Set", making the changes there, and creating the patch from the "Team" context menu on the changed source file/package/project.
Comment 3 Chris Jaun CLA 2009-09-15 11:21:21 EDT
Categorizing JSDT bugzillas for planning purposes.
Comment 4 Chris Jaun CLA 2010-07-14 14:39:29 EDT
I don't understand the expression you are trying to create.

Your example is setting the name of the object literal field to a function expression?

That does not appear to be valid JavaScript to me.

If I am missing something please re-open.