Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359386 - Type mismatch: cannot convert from Calendar to EAny
Summary: Type mismatch: cannot convert from Calendar to EAny
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-29 05:46 EDT by pf yu CLA
Modified: 2017-02-23 14:16 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pf yu CLA 2011-09-29 05:46:17 EDT
Build Identifier: 201109282102

Type mismatch: cannot convert from Calendar to EAny

Reproducible: Always

Steps to Reproduce:
1. Check out project "org.eclipse.edt.eunit.test" from kan-cvs.
2. Add java generator to the project.
3. Clean the whole workspace.
4. The issue exists in:
fvt.operators.TestConcatOperatorsLib
Comment 1 Matt Heitz CLA 2011-09-29 10:46:25 EDT
Here's a simple testcase that shows the problem.

        nDate date? = "06/06/1944";
        a any = nDate;

The second line has the error.  It's generated as 

a = (Calendar) org.eclipse.edt.javart.util.JavartUtil.checkNullable(EDate.ezeBox(nDate));

One solution would be to box the result of checkNullable, like this

a = EDate.ezeBox(org.eclipse.edt.javart.util.JavartUtil.checkNullable(nDate));
Comment 2 Jeff Douglas CLA 2011-09-30 10:34:49 EDT
The checkNullable method isn't really the problem. The problem is the runtime is missing a method call.
Comment 3 Jeff Douglas CLA 2011-09-30 10:41:44 EDT
Some type of conversion needs to be done for sure, however a huge amount of this testcase is nonsense. There are many attempts to use :: to concatenate things like ints. There is no such function for this and causes the testcase to blow up when trying to generate.

There should be many validation errors here.
Comment 4 Jeff Douglas CLA 2011-10-01 08:18:40 EDT
fixed
Comment 5 Matt Heitz CLA 2011-10-03 11:16:27 EDT
I'm reopening this because it *IS* valid to concatenate things like ints with the :: operator.  The :: operator is defined in EString to take two string operands.  Thanks to EString.asString(EInt), ints can be converted to strings, so ints are valid operands for concatenation.

Also, if we ever find a case where there should've been validation errors, someone should make sure a defect exists report the validation problem.  Sometimes we can do this by changing the component to Compiler, or we can open a new defect.
Comment 6 Matt Heitz CLA 2011-10-05 10:35:56 EDT
Resolving this again because Tim has decided that EDT's :: operator won't be like the one in RBD.  The thing on the left of :: should be a string.
Comment 7 pf yu CLA 2011-10-12 05:04:55 EDT
Verified in build 201110110900
Comment 8 Matt Heitz CLA 2012-10-05 09:53:34 EDT
I read the conclusion of this year-old bug yesterday, and realized that we never implemented the validation rule mentioned in comment 6.  It says the thing on the left of :: must be a string.

I discussed it with Paul and Tim, we decided NOT to add that new rule.  We'll continue to allow the left side of :: to be anything that's compatible with string, or a list.

I'm going to try the testcase in 0.8.2, and I'll open a new bug if I find a problem.