Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343693 - [1.7] Adjust subclasses of AllocationExpression for <> support
Summary: [1.7] Adjust subclasses of AllocationExpression for <> support
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-23 21:41 EDT by Srikanth Sankaran CLA
Modified: 2011-08-05 02:54 EDT (History)
2 users (show)

See Also:
srikanth_sankaran: review+


Attachments
A Patch (5.12 KB, patch)
2011-05-24 05:30 EDT, Satyam Kandula CLA
no flags Details | Diff
Proposed patch + regression tests (10.64 KB, patch)
2011-05-24 07:30 EDT, Satyam Kandula CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2011-04-23 21:41:16 EDT
All of the subclasses of AllocationExpression need to be
inspected to see if they need to change suitably for <>

With the patch posted at bug 339478 comment 33 (this patch
addresses, AE and QAE fully) compiler support is fully in place,
but code select fails in the following test case:

public class X<T> {
        T field1;
        public X(T param) {
            field1 = param;
        }
        public static void testFunction(String param){
            System.out.println(1);
        }
        public static void testFunction(Object Param) {
            System.out.println(2);
        }
        public T getField() {
            return field1;
        }
        public static void main(String[] args) {
            X.testFunction(new X<>("hello").getField());
        }
}

Clicking on the X just before the <> takes me to the class rather
than to the constructor. If the type was not elided, it takes me
to the constructor.

The subclasses around javadoc, completion, selection and code snippet
evaluation needs to change suitably. Ayush, please engage Satyam as
needed. Please mark me as reviewer - Thanks.
Comment 1 Satyam Kandula CLA 2011-05-23 07:20:22 EDT
I will look into this.
Comment 2 Satyam Kandula CLA 2011-05-24 05:30:35 EDT
Created attachment 196413 [details]
A Patch

This patch fixes the selection problems, but code snippet evaluator still has problems. CodeSnippetAllocationExpression overrides AllocationExpression#resolvedType and this function has to take care of the new changes that has happened. I am currently looking into it.
Comment 3 Satyam Kandula CLA 2011-05-24 07:30:02 EDT
Created attachment 196426 [details]
Proposed patch + regression tests

I missed out the changes in SelectionParser in my last patch :(
This patch also fixes the problem in code snippet processing also - some more testing need to be done here.
Comment 4 Satyam Kandula CLA 2011-05-25 04:37:51 EDT
All tests pass. 
Srikanth, Please review.
Comment 5 Srikanth Sankaran CLA 2011-05-25 08:14:17 EDT
Patch looks good to me.
Comment 6 Satyam Kandula CLA 2011-05-26 05:32:46 EDT
Srikanth found one problem while trying to call the constructor of an inner class of a parameterized outer type through the display view. This happens even without diamond case and happens on older versions also and hence filed 347274 to track that.
Comment 7 Satyam Kandula CLA 2011-05-26 05:38:58 EDT
Thanks Srikanth for the review. 
Released the patch in the Java7 branch
Comment 8 Stephan Herrmann CLA 2011-06-28 08:25:25 EDT
Verified using patch feature 1.0.0-20110623-0900