Bug 345363 - [content assist] FUP of bug 336451: Add a regression test
Summary: [content assist] FUP of bug 336451: Add a regression test
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.7 RC1   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks:
 
Reported: 2011-05-11 01:35 EDT by Ayushman Jain CLA
Modified: 2011-05-16 06:34 EDT (History)
1 user (show)

See Also:


Attachments
testcase (5.85 KB, patch)
2011-05-11 07:17 EDT, Ayushman Jain CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2011-05-11 01:35:54 EDT
HEAD.
After the fix for bug 336451, content assist no longer throws a CCE exception. But its not possible to test it with content assist tests inside JDT/Core since the problem was with compiler bindings, which are only used when code complete is invoked from outside. 
It will be good to have a regression test for this case.

public class EclipseTest {
    private static interface InvokerIF{
        public <T extends ArgIF> T invoke(T arg) throws Exception;
    }

    private static class Invoker implements InvokerIF{
        public <T extends ArgIF> T invoke(T arg){
            return arg;
        }
    }

    private static interface ArgIF{
    }

    private static interface ArgIF2<C> extends ArgIF{

    }
    private static class ArgImpl<C> implements ArgIF2<C>{
        public ArgImpl() {
            super();
        }
    }
    public static void main(String[] args) throws Exception {
        InvokerIF test = new Invoker();
        test.invoke(new ArgImpl[CTRL-SPC])
    }
}
Comment 1 Dani Megert CLA 2011-05-11 03:19:48 EDT
>It will be good to have a regression test for this case
Indeed :-)

Can you please provide one? You probably want to add it to:
org.eclipse.jdt.text.tests.contentassist.TypeCompletionTest
Comment 2 Ayushman Jain CLA 2011-05-11 07:17:04 EDT
Created attachment 195325 [details]
testcase

Attaching a test for CodeCompletionTest. I don't know how to test this in TypeCompletionTest

Also, I havent run this test. The o.e.jdt.text.tests has millions of dependencies. It takes quite long to check out so many projects with slow connections here. It'll be more convenient for some1 who already has the setup to take this test and commit it. Dani, can you please take it forward? Thanks!
Comment 3 Dani Megert CLA 2011-05-11 09:57:00 EDT
Thanks Ayush. The test was almost good but failed due to missing:

collector.setAllowsRequiredProposals(CompletionProposal.CONSTRUCTOR_INVOCATION, CompletionProposal.TYPE_REF, true);

Adjusted the test and committed to HEAD.
Comment 4 Dani Megert CLA 2011-05-16 06:34:09 EDT
Verified in I20110512-2000 that the test is works and got released into the
map file.