Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345363

Summary: [content assist] FUP of bug 336451: Add a regression test
Product: [Eclipse Project] JDT Reporter: Ayushman Jain <amj87.iitr>
Component: TextAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert
Version: 3.7Keywords: test
Target Milestone: 3.7 RC1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
testcase none

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.