Bug 235783

Summary: [eval] CodeSnippetParser and some 'CodeSnippet*' ast node does not seem up to date
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, Olivier_Thomann, srikanth_sankaran
Version: 3.4   
Target Milestone: 3.6 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix + regression tests none

Description David Audel CLA 2008-06-05 05:37:00 EDT
build I20080603-2000

Some part of CodeSnippetParser class and special ast nodes made by this parser does not seem up to date compared to Parser.

CodeSnippetParser overrides 'classInstanceCreation(boolean)' but doesn't override 'consumeClassInstanceCreationExpressionQualifiedWithTypeArguments()' and 'consumeClassInstanceCreationExpressionWithTypeArguments()'.
This is probably the cause of bug 235775.

CodeSnippetParser overrides 'newMessageSend()' but does not override 'newMessageSendWithTypeArguments().
This is probably the cause of bug 235774.
Comment 1 David Audel CLA 2008-06-05 05:37:51 EDT
CodeSnippetParser overrides 'consumeClassHeaderName1' and 'consumeInterfaceHeaderName1' but doesn't override 'consumeEnumHeaderName' and 'consumeAnnotationTypeDeclarationHeaderName'.
I do not understand why 'consumeInterfaceHeaderName1' is overridden because a snippet contain only one top level class and no top level interface.
So 'consumeInterfaceHeaderName1' seems useless in CodeSnippetParser.
Comment 2 David Audel CLA 2008-06-05 05:47:38 EDT
CodeSnippetAllocationExpression.resolveType(BlockScope scope) does not take into account parameterized allocation and type arguments like AllocationExpression.resolveType(BlockScope scope)
Comment 3 David Audel CLA 2008-06-05 06:09:20 EDT
CodeSnippetParser overrides 'consumeMethodInvocationName' and 'consumeMethodInvocationSuper' but does not override 'consumeMethodInvocationNameWithTypeArguments' and 'consumeMethodInvocationSuperWithTypeArguments'.
Comment 4 Olivier Thomann CLA 2009-12-15 10:55:52 EST
*** Bug 235774 has been marked as a duplicate of this bug. ***
Comment 5 Olivier Thomann CLA 2009-12-15 10:57:21 EST
*** Bug 235775 has been marked as a duplicate of this bug. ***
Comment 6 Olivier Thomann CLA 2009-12-15 10:58:35 EST
Adding the missing method seems to fix it.
Comment 7 Olivier Thomann CLA 2009-12-15 11:32:01 EST
Created attachment 154492 [details]
Proposed fix + regression tests

This patch fixes both problems reported in 235774 and 235775.
Comment 8 Olivier Thomann CLA 2010-01-04 10:13:49 EST
Released for 3.6M5.
Added regression tests:
org.eclipse.jdt.core.tests.eval.DebugEvaluationTest#test065
org.eclipse.jdt.core.tests.eval.DebugEvaluationTest#test066
org.eclipse.jdt.core.tests.eval.DebugEvaluationTest#test067
Comment 9 Ayushman Jain CLA 2010-01-25 02:49:53 EST
verified for 3.6M5 using build  I20100122-0800.
Comment 10 Ayushman Jain CLA 2010-01-25 02:53:09 EST
A few observations though:

1) CodeSnippetParser still doesnt implement 
 (a) consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() as per description
 (b) consumeEnumHeaderName() and consumeAnnotationTypeDeclarationHeaderName() as per comment 1.

Is this intentional?

2) There's no separate regression test added to verify the new method consumeMethodInvocationSuperWithTypeArguments().
Comment 11 Olivier Thomann CLA 2010-01-25 14:53:37 EST
You are right. Some methods are still missing.
See bug 300723.
The methods reported in comment 0 have been added. This is why I am closing as VERIFIED.